市长热线演示版

T_Fax_SentFax.cs 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using HySoft.DBUtility;
  7. using System.Data.SqlClient;
  8. namespace HySoft.BaseCallCenter.DAL
  9. {
  10. //T_Fax_SentFax
  11. public partial class T_Fax_SentFax
  12. {
  13. public bool Exists(int FaxID)
  14. {
  15. StringBuilder strSql = new StringBuilder();
  16. strSql.Append("select count(1) from T_Fax_SentFax");
  17. strSql.Append(" where ");
  18. strSql.Append(" FaxID = @FaxID ");
  19. SqlParameter[] parameters = {
  20. new SqlParameter("@FaxID", SqlDbType.Int,4) };
  21. parameters[0].Value = FaxID;
  22. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  23. }
  24. /// <summary>
  25. /// 增加一条数据
  26. /// </summary>
  27. public void Add(Model.T_Fax_SentFax model)
  28. {
  29. StringBuilder strSql = new StringBuilder();
  30. strSql.Append("insert into T_Fax_SentFax(");
  31. strSql.Append("FaxID,SendTime,LastSentTime,CurSentCount,MaxSendCount,Info,FileState,State,F_UserID,F_CustomerID,F_Name,TelNum,F_FaxCode,WebFilePath,FileName,FilePath,TifFilePath,FileSize,FileType,Remark,CommitTime");
  32. strSql.Append(") values (");
  33. strSql.Append("@FaxID,@SendTime,@LastSentTime,@CurSentCount,@MaxSendCount,@Info,@FileState,@State,@F_UserID,@F_CustomerID,@F_Name,@TelNum,@F_FaxCode,@WebFilePath,@FileName,@FilePath,@TifFilePath,@FileSize,@FileType,@Remark,@CommitTime");
  34. strSql.Append(") ");
  35. SqlParameter[] parameters = {
  36. new SqlParameter("@FaxID", SqlDbType.Int,4) ,
  37. new SqlParameter("@SendTime", SqlDbType.DateTime) ,
  38. new SqlParameter("@LastSentTime", SqlDbType.DateTime) ,
  39. new SqlParameter("@CurSentCount", SqlDbType.Int,4) ,
  40. new SqlParameter("@MaxSendCount", SqlDbType.Int,4) ,
  41. new SqlParameter("@Info", SqlDbType.VarChar,200) ,
  42. new SqlParameter("@FileState", SqlDbType.Int,4) ,
  43. new SqlParameter("@State", SqlDbType.Int,4) ,
  44. new SqlParameter("@F_UserID", SqlDbType.Int,4) ,
  45. new SqlParameter("@F_CustomerID", SqlDbType.Int,4) ,
  46. new SqlParameter("@F_Name", SqlDbType.NVarChar,50) ,
  47. new SqlParameter("@TelNum", SqlDbType.VarChar,20) ,
  48. new SqlParameter("@F_FaxCode", SqlDbType.VarChar,20) ,
  49. new SqlParameter("@WebFilePath", SqlDbType.VarChar,200) ,
  50. new SqlParameter("@FileName", SqlDbType.VarChar,50) ,
  51. new SqlParameter("@FilePath", SqlDbType.VarChar,200) ,
  52. new SqlParameter("@TifFilePath", SqlDbType.VarChar,200) ,
  53. new SqlParameter("@FileSize", SqlDbType.Int,4) ,
  54. new SqlParameter("@FileType", SqlDbType.VarChar,20) ,
  55. new SqlParameter("@Remark", SqlDbType.VarChar,200) ,
  56. new SqlParameter("@CommitTime", SqlDbType.DateTime)
  57. };
  58. parameters[0].Value = model.FaxID;
  59. parameters[1].Value = model.SendTime;
  60. parameters[2].Value = model.LastSentTime;
  61. parameters[3].Value = model.CurSentCount;
  62. parameters[4].Value = model.MaxSendCount;
  63. parameters[5].Value = model.Info;
  64. parameters[6].Value = model.FileState;
  65. parameters[7].Value = model.State;
  66. parameters[8].Value = model.F_UserID;
  67. parameters[9].Value = model.F_CustomerID;
  68. parameters[10].Value = model.F_Name;
  69. parameters[11].Value = model.TelNum;
  70. parameters[12].Value = model.F_FaxCode;
  71. parameters[13].Value = model.WebFilePath;
  72. parameters[14].Value = model.FileName;
  73. parameters[15].Value = model.FilePath;
  74. parameters[16].Value = model.TifFilePath;
  75. parameters[17].Value = model.FileSize;
  76. parameters[18].Value = model.FileType;
  77. parameters[19].Value = model.Remark;
  78. parameters[20].Value = model.CommitTime;
  79. DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  80. }
  81. /// <summary>
  82. /// 重新发送
  83. /// </summary>
  84. /// <param name="arrFaxID">发送的ID</param>
  85. /// <returns></returns>
  86. public int ReSend(string arrFaxID)
  87. {
  88. StringBuilder strSql = new StringBuilder();
  89. strSql.Append("insert into T_Fax_SendFaxTask(");
  90. strSql.Append("TelNum,FilePath,TifFilePath,FileSize,FileType,Remark,CommitTime,SendTime,LastSentTime,CurSentCount,MaxSendCount,Info,FileState,State,F_UserID,F_CustomerID,F_Name,FileName)");
  91. strSql.Append(" select TelNum,FilePath,TifFilePath,FileSize,FileType,Remark,getdate(),getdate(),null,0,MaxSendCount,'',FileState,0,F_UserID,F_CustomerID,F_Name,FileName ");
  92. strSql.Append(" from T_Fax_SentFax ");
  93. if (arrFaxID.IndexOf(",") == -1)
  94. {
  95. strSql.Append(" where FaxID = " + arrFaxID);
  96. }
  97. else
  98. {
  99. strSql.Append(" where FaxID in (" + arrFaxID + ") ");
  100. }
  101. return DbHelperSQL.ExecuteSql(strSql.ToString());
  102. }
  103. /// <summary>
  104. /// 更新一条数据
  105. /// </summary>
  106. public bool Update(Model.T_Fax_SentFax model)
  107. {
  108. StringBuilder strSql = new StringBuilder();
  109. strSql.Append("update T_Fax_SentFax set ");
  110. strSql.Append(" FaxID = @FaxID , ");
  111. strSql.Append(" SendTime = @SendTime , ");
  112. strSql.Append(" LastSentTime = @LastSentTime , ");
  113. strSql.Append(" CurSentCount = @CurSentCount , ");
  114. strSql.Append(" MaxSendCount = @MaxSendCount , ");
  115. strSql.Append(" Info = @Info , ");
  116. strSql.Append(" FileState = @FileState , ");
  117. strSql.Append(" State = @State , ");
  118. strSql.Append(" F_UserID = @F_UserID , ");
  119. strSql.Append(" F_CustomerID = @F_CustomerID , ");
  120. strSql.Append(" F_Name = @F_Name , ");
  121. strSql.Append(" TelNum = @TelNum , ");
  122. strSql.Append(" F_FaxCode = @F_FaxCode , ");
  123. strSql.Append(" WebFilePath = @WebFilePath , ");
  124. strSql.Append(" FileName = @FileName , ");
  125. strSql.Append(" FilePath = @FilePath , ");
  126. strSql.Append(" TifFilePath = @TifFilePath , ");
  127. strSql.Append(" FileSize = @FileSize , ");
  128. strSql.Append(" FileType = @FileType , ");
  129. strSql.Append(" Remark = @Remark , ");
  130. strSql.Append(" CommitTime = @CommitTime ");
  131. strSql.Append(" where FaxID=@FaxID ");
  132. SqlParameter[] parameters = {
  133. new SqlParameter("@FaxID", SqlDbType.Int,4) ,
  134. new SqlParameter("@SendTime", SqlDbType.DateTime) ,
  135. new SqlParameter("@LastSentTime", SqlDbType.DateTime) ,
  136. new SqlParameter("@CurSentCount", SqlDbType.Int,4) ,
  137. new SqlParameter("@MaxSendCount", SqlDbType.Int,4) ,
  138. new SqlParameter("@Info", SqlDbType.VarChar,200) ,
  139. new SqlParameter("@FileState", SqlDbType.Int,4) ,
  140. new SqlParameter("@State", SqlDbType.Int,4) ,
  141. new SqlParameter("@F_UserID", SqlDbType.Int,4) ,
  142. new SqlParameter("@F_CustomerID", SqlDbType.Int,4) ,
  143. new SqlParameter("@F_Name", SqlDbType.NVarChar,50) ,
  144. new SqlParameter("@TelNum", SqlDbType.VarChar,20) ,
  145. new SqlParameter("@F_FaxCode", SqlDbType.VarChar,20) ,
  146. new SqlParameter("@WebFilePath", SqlDbType.VarChar,200) ,
  147. new SqlParameter("@FileName", SqlDbType.VarChar,50) ,
  148. new SqlParameter("@FilePath", SqlDbType.VarChar,200) ,
  149. new SqlParameter("@TifFilePath", SqlDbType.VarChar,200) ,
  150. new SqlParameter("@FileSize", SqlDbType.Int,4) ,
  151. new SqlParameter("@FileType", SqlDbType.VarChar,20) ,
  152. new SqlParameter("@Remark", SqlDbType.VarChar,200) ,
  153. new SqlParameter("@CommitTime", SqlDbType.DateTime)
  154. };
  155. parameters[0].Value = model.FaxID;
  156. parameters[1].Value = model.SendTime;
  157. parameters[2].Value = model.LastSentTime;
  158. parameters[3].Value = model.CurSentCount;
  159. parameters[4].Value = model.MaxSendCount;
  160. parameters[5].Value = model.Info;
  161. parameters[6].Value = model.FileState;
  162. parameters[7].Value = model.State;
  163. parameters[8].Value = model.F_UserID;
  164. parameters[9].Value = model.F_CustomerID;
  165. parameters[10].Value = model.F_Name;
  166. parameters[11].Value = model.TelNum;
  167. parameters[12].Value = model.F_FaxCode;
  168. parameters[13].Value = model.WebFilePath;
  169. parameters[14].Value = model.FileName;
  170. parameters[15].Value = model.FilePath;
  171. parameters[16].Value = model.TifFilePath;
  172. parameters[17].Value = model.FileSize;
  173. parameters[18].Value = model.FileType;
  174. parameters[19].Value = model.Remark;
  175. parameters[20].Value = model.CommitTime;
  176. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  177. if (rows > 0)
  178. {
  179. return true;
  180. }
  181. else
  182. {
  183. return false;
  184. }
  185. }
  186. /// <summary>
  187. /// 更新一条数据
  188. /// </summary>
  189. public int UpdateWebFilePath(Model.T_Fax_SentFax model)
  190. {
  191. StringBuilder strSql = new StringBuilder();
  192. strSql.Append("update T_Fax_SentFax set ");
  193. strSql.Append("WebFilePath=@WebFilePath");
  194. strSql.Append(" where FaxID=@FaxID ");
  195. SqlParameter[] parameters = {
  196. new SqlParameter("@FaxID", SqlDbType.Int,4),
  197. new SqlParameter("@WebFilePath", SqlDbType.VarChar,200)};
  198. parameters[0].Value = model.FaxID;
  199. parameters[1].Value = model.WebFilePath;
  200. return DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  201. }
  202. /// <summary>
  203. /// 删除一条数据
  204. /// </summary>
  205. public bool Delete(int FaxID)
  206. {
  207. StringBuilder strSql = new StringBuilder();
  208. strSql.Append("delete from T_Fax_SentFax ");
  209. strSql.Append(" where FaxID=@FaxID ");
  210. SqlParameter[] parameters = {
  211. new SqlParameter("@FaxID", SqlDbType.Int,4) };
  212. parameters[0].Value = FaxID;
  213. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  214. if (rows > 0)
  215. {
  216. return true;
  217. }
  218. else
  219. {
  220. return false;
  221. }
  222. }
  223. /// <summary>
  224. /// 批量删除一批数据
  225. /// </summary>
  226. public bool DeleteList(string FaxIDlist)
  227. {
  228. StringBuilder strSql = new StringBuilder();
  229. strSql.Append("delete from T_Fax_SentFax ");
  230. strSql.Append(" where FaxID in (" + FaxIDlist + ") ");
  231. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  232. if (rows > 0)
  233. {
  234. return true;
  235. }
  236. else
  237. {
  238. return false;
  239. }
  240. }
  241. /// <summary>
  242. /// 得到一个对象实体
  243. /// </summary>
  244. public Model.T_Fax_SentFax GetModel(int FaxID)
  245. {
  246. StringBuilder strSql = new StringBuilder();
  247. strSql.Append("select FaxID, SendTime, LastSentTime, CurSentCount, MaxSendCount, Info, FileState, State, F_UserID, F_CustomerID, F_Name, TelNum, F_FaxCode, WebFilePath, FileName, FilePath, TifFilePath, FileSize, FileType, Remark, CommitTime ");
  248. strSql.Append(" from T_Fax_SentFax ");
  249. strSql.Append(" where FaxID=@FaxID ");
  250. SqlParameter[] parameters = {
  251. new SqlParameter("@FaxID", SqlDbType.Int,4) };
  252. parameters[0].Value = FaxID;
  253. Model.T_Fax_SentFax model = new Model.T_Fax_SentFax();
  254. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  255. if (ds.Tables[0].Rows.Count > 0)
  256. {
  257. if (ds.Tables[0].Rows[0]["FaxID"].ToString() != "")
  258. {
  259. model.FaxID = int.Parse(ds.Tables[0].Rows[0]["FaxID"].ToString());
  260. }
  261. if (ds.Tables[0].Rows[0]["SendTime"].ToString() != "")
  262. {
  263. model.SendTime = DateTime.Parse(ds.Tables[0].Rows[0]["SendTime"].ToString());
  264. }
  265. if (ds.Tables[0].Rows[0]["LastSentTime"].ToString() != "")
  266. {
  267. model.LastSentTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastSentTime"].ToString());
  268. }
  269. if (ds.Tables[0].Rows[0]["CurSentCount"].ToString() != "")
  270. {
  271. model.CurSentCount = int.Parse(ds.Tables[0].Rows[0]["CurSentCount"].ToString());
  272. }
  273. if (ds.Tables[0].Rows[0]["MaxSendCount"].ToString() != "")
  274. {
  275. model.MaxSendCount = int.Parse(ds.Tables[0].Rows[0]["MaxSendCount"].ToString());
  276. }
  277. model.Info = ds.Tables[0].Rows[0]["Info"].ToString();
  278. if (ds.Tables[0].Rows[0]["FileState"].ToString() != "")
  279. {
  280. model.FileState = int.Parse(ds.Tables[0].Rows[0]["FileState"].ToString());
  281. }
  282. if (ds.Tables[0].Rows[0]["State"].ToString() != "")
  283. {
  284. model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
  285. }
  286. if (ds.Tables[0].Rows[0]["F_UserID"].ToString() != "")
  287. {
  288. model.F_UserID = int.Parse(ds.Tables[0].Rows[0]["F_UserID"].ToString());
  289. }
  290. if (ds.Tables[0].Rows[0]["F_CustomerID"].ToString() != "")
  291. {
  292. model.F_CustomerID = int.Parse(ds.Tables[0].Rows[0]["F_CustomerID"].ToString());
  293. }
  294. model.F_Name = ds.Tables[0].Rows[0]["F_Name"].ToString();
  295. model.TelNum = ds.Tables[0].Rows[0]["TelNum"].ToString();
  296. model.F_FaxCode = ds.Tables[0].Rows[0]["F_FaxCode"].ToString();
  297. model.WebFilePath = ds.Tables[0].Rows[0]["WebFilePath"].ToString();
  298. model.FileName = ds.Tables[0].Rows[0]["FileName"].ToString();
  299. model.FilePath = ds.Tables[0].Rows[0]["FilePath"].ToString();
  300. model.TifFilePath = ds.Tables[0].Rows[0]["TifFilePath"].ToString();
  301. if (ds.Tables[0].Rows[0]["FileSize"].ToString() != "")
  302. {
  303. model.FileSize = int.Parse(ds.Tables[0].Rows[0]["FileSize"].ToString());
  304. }
  305. model.FileType = ds.Tables[0].Rows[0]["FileType"].ToString();
  306. model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
  307. if (ds.Tables[0].Rows[0]["CommitTime"].ToString() != "")
  308. {
  309. model.CommitTime = DateTime.Parse(ds.Tables[0].Rows[0]["CommitTime"].ToString());
  310. }
  311. return model;
  312. }
  313. else
  314. {
  315. return null;
  316. }
  317. }
  318. /// <summary>
  319. /// 获得数据列表
  320. /// </summary>
  321. public DataSet GetList(string strWhere)
  322. {
  323. StringBuilder strSql = new StringBuilder();
  324. strSql.Append("select * ");
  325. strSql.Append(" FROM T_Fax_SentFax ");
  326. if (strWhere.Trim() != "")
  327. {
  328. strSql.Append(" where " + strWhere);
  329. }
  330. return DbHelperSQL.Query(strSql.ToString());
  331. }
  332. /// <summary>
  333. /// 获得前几行数据
  334. /// </summary>
  335. public DataSet GetList(int Top, string strWhere, string filedOrder)
  336. {
  337. StringBuilder strSql = new StringBuilder();
  338. strSql.Append("select ");
  339. if (Top > 0)
  340. {
  341. strSql.Append(" top " + Top.ToString());
  342. }
  343. strSql.Append(" * ");
  344. strSql.Append(" FROM T_Fax_SentFax ");
  345. if (strWhere.Trim() != "")
  346. {
  347. strSql.Append(" where " + strWhere);
  348. }
  349. strSql.Append(" order by " + filedOrder);
  350. return DbHelperSQL.Query(strSql.ToString());
  351. }
  352. }
  353. }