Brak opisu

T_Data_Assessment.cs 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. using CallCenterApi.DB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CallCenterApi.DAL
  10. {
  11. /// <summary>
  12. /// 数据访问类:T_Data_Assessment
  13. /// </summary>
  14. public partial class T_Data_Assessment
  15. {
  16. public T_Data_Assessment()
  17. { }
  18. #region Method
  19. /// <summary>
  20. /// 是否存在该记录
  21. /// </summary>
  22. public bool Exists(int F_Id)
  23. {
  24. StringBuilder strSql = new StringBuilder();
  25. strSql.Append("select count(1) from T_Data_Assessment");
  26. strSql.Append(" where F_Id=@F_Id");
  27. SqlParameter[] parameters = {
  28. new SqlParameter("@F_Id", SqlDbType.Int,4)
  29. };
  30. parameters[0].Value = F_Id;
  31. return DbHelperSQL.Exists(strSql.ToString(), parameters);
  32. }
  33. /// <summary>
  34. /// 更新一条数据
  35. /// </summary>
  36. public bool Update(CallCenterApi.Model.T_Data_Assessment model)
  37. {
  38. StringBuilder strSql = new StringBuilder();
  39. strSql.Append("update T_Data_Assessment set ");
  40. strSql.Append("F_DeptId=@F_DeptId,");
  41. strSql.Append("F_DeptName=@F_DeptName,");
  42. strSql.Append("F_PartentId=@F_PartentId,");
  43. strSql.Append("F_BatchNo=@F_BatchNo,");
  44. strSql.Append("F_CS_ReciveCount=@F_CS_ReciveCount,");
  45. strSql.Append("F_CS_RecTimelyCount=@F_CS_RecTimelyCount,");
  46. strSql.Append("F_JB_AssginCount=@F_JB_AssginCount,");
  47. strSql.Append("F_JB_HandleCount=@F_JB_HandleCount,");
  48. strSql.Append("F_JB_HandleOverCount=@F_JB_HandleOverCount,");
  49. strSql.Append("F_HF_VisitCount=@F_HF_VisitCount,");
  50. strSql.Append("F_HF_SatisfiedCount=@F_HF_SatisfiedCount,");
  51. strSql.Append("F_HF_DissatisfiedCount=@F_HF_DissatisfiedCount,");
  52. strSql.Append("F_TH_BackCount=@F_TH_BackCount,");
  53. strSql.Append("F_TH_BackTimelyCount=@F_TH_BackTimelyCount,");
  54. strSql.Append("F_ZSK_ActualCount=@F_ZSK_ActualCount,");
  55. strSql.Append("F_ZSK_ShouldCount=@F_ZSK_ShouldCount,");
  56. strSql.Append("F_ZSK_CorrCount=@F_ZSK_CorrCount,");
  57. strSql.Append("F_GF_NonstandardCount=@F_GF_NonstandardCount,");
  58. strSql.Append("F_TB_BulletinOrderCount=@F_TB_BulletinOrderCount,");
  59. strSql.Append("F_TB_BulletinCount=@F_TB_BulletinCount,");
  60. strSql.Append("F_DF_CSCore=@F_DF_CSCore,");
  61. strSql.Append("F_DF_THCore=@F_DF_THCore,");
  62. strSql.Append("F_DF_BLCore=@F_DF_BLCore,");
  63. strSql.Append("F_DF_HFCore=@F_DF_HFCore,");
  64. strSql.Append("F_DF_ZSKCore=@F_DF_ZSKCore,");
  65. strSql.Append("F_DF_GFCore=@F_DF_GFCore,");
  66. strSql.Append("F_DF_TBCore=@F_DF_TBCore,");
  67. strSql.Append("F_DF_ZJ=@F_DF_ZJ,");
  68. strSql.Append("F_SSLimittime=@F_SSLimittime,");
  69. strSql.Append("F_CreateTime=@F_CreateTime");
  70. strSql.Append(" where F_Id=@F_Id");
  71. SqlParameter[] parameters = {
  72. new SqlParameter("@F_DeptId", SqlDbType.Int,4),
  73. new SqlParameter("@F_DeptName", SqlDbType.NVarChar,100),
  74. new SqlParameter("@F_PartentId", SqlDbType.Int,4),
  75. new SqlParameter("@F_BatchNo", SqlDbType.NVarChar,8),
  76. new SqlParameter("@F_CS_ReciveCount", SqlDbType.Int,4),
  77. new SqlParameter("@F_CS_RecTimelyCount", SqlDbType.Int,4),
  78. new SqlParameter("@F_JB_AssginCount", SqlDbType.Int,4),
  79. new SqlParameter("@F_JB_HandleCount", SqlDbType.Int,4),
  80. new SqlParameter("@F_JB_HandleOverCount", SqlDbType.Int,4),
  81. new SqlParameter("@F_HF_VisitCount", SqlDbType.Int,4),
  82. new SqlParameter("@F_HF_SatisfiedCount", SqlDbType.Int,4),
  83. new SqlParameter("@F_HF_DissatisfiedCount", SqlDbType.Int,4),
  84. new SqlParameter("@F_TH_BackCount", SqlDbType.Int,4),
  85. new SqlParameter("@F_TH_BackTimelyCount", SqlDbType.Int,4),
  86. new SqlParameter("@F_ZSK_ActualCount", SqlDbType.Int,4),
  87. new SqlParameter("@F_ZSK_ShouldCount", SqlDbType.Int,4),
  88. new SqlParameter("@F_ZSK_CorrCount", SqlDbType.Int,4),
  89. new SqlParameter("@F_GF_NonstandardCount", SqlDbType.Int,4),
  90. new SqlParameter("@F_TB_BulletinOrderCount", SqlDbType.Int,4),
  91. new SqlParameter("@F_TB_BulletinCount", SqlDbType.Int,4),
  92. new SqlParameter("@F_DF_CSCore", SqlDbType.Decimal,9),
  93. new SqlParameter("@F_DF_THCore", SqlDbType.Decimal,9),
  94. new SqlParameter("@F_DF_BLCore", SqlDbType.Decimal,9),
  95. new SqlParameter("@F_DF_HFCore", SqlDbType.Decimal,9),
  96. new SqlParameter("@F_DF_ZSKCore", SqlDbType.Decimal,9),
  97. new SqlParameter("@F_DF_GFCore", SqlDbType.Decimal,9),
  98. new SqlParameter("@F_DF_TBCore", SqlDbType.Decimal,9),
  99. new SqlParameter("@F_DF_ZJ", SqlDbType.Decimal,9),
  100. new SqlParameter("@F_SSLimittime", SqlDbType.DateTime),
  101. new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
  102. new SqlParameter("@F_Id", SqlDbType.Int,4)};
  103. parameters[0].Value = model.F_DeptId;
  104. parameters[1].Value = model.F_DeptName;
  105. parameters[2].Value = model.F_PartentId;
  106. parameters[3].Value = model.F_BatchNo;
  107. parameters[4].Value = model.F_CS_ReciveCount;
  108. parameters[5].Value = model.F_CS_RecTimelyCount;
  109. parameters[6].Value = model.F_JB_AssginCount;
  110. parameters[7].Value = model.F_JB_HandleCount;
  111. parameters[8].Value = model.F_JB_HandleOverCount;
  112. parameters[9].Value = model.F_HF_VisitCount;
  113. parameters[10].Value = model.F_HF_SatisfiedCount;
  114. parameters[11].Value = model.F_HF_DissatisfiedCount;
  115. parameters[12].Value = model.F_TH_BackCount;
  116. parameters[13].Value = model.F_TH_BackTimelyCount;
  117. parameters[14].Value = model.F_ZSK_ActualCount;
  118. parameters[15].Value = model.F_ZSK_ShouldCount;
  119. parameters[16].Value = model.F_ZSK_CorrCount;
  120. parameters[17].Value = model.F_GF_NonstandardCount;
  121. parameters[18].Value = model.F_TB_BulletinOrderCount;
  122. parameters[19].Value = model.F_TB_BulletinCount;
  123. parameters[20].Value = model.F_DF_CSCore;
  124. parameters[21].Value = model.F_DF_THCore;
  125. parameters[22].Value = model.F_DF_BLCore;
  126. parameters[23].Value = model.F_DF_HFCore;
  127. parameters[24].Value = model.F_DF_ZSKCore;
  128. parameters[25].Value = model.F_DF_GFCore;
  129. parameters[26].Value = model.F_DF_TBCore;
  130. parameters[27].Value = model.F_DF_ZJ;
  131. parameters[28].Value = model.F_SSLimittime;
  132. parameters[29].Value = model.F_CreateTime;
  133. parameters[30].Value = model.F_Id;
  134. int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
  135. if (rows > 0)
  136. {
  137. return true;
  138. }
  139. else
  140. {
  141. return false;
  142. }
  143. }
  144. /// <summary>
  145. /// 得到一个对象实体
  146. /// </summary>
  147. public CallCenterApi.Model.T_Data_Assessment GetModel(int F_Id)
  148. {
  149. StringBuilder strSql = new StringBuilder();
  150. strSql.Append("select top 1 * from T_Data_Assessment ");
  151. strSql.Append(" where F_Id=@F_Id");
  152. SqlParameter[] parameters = {
  153. new SqlParameter("@F_Id", SqlDbType.Int,4)
  154. };
  155. parameters[0].Value = F_Id;
  156. CallCenterApi.Model.T_Data_Assessment model = new CallCenterApi.Model.T_Data_Assessment();
  157. DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
  158. if (ds.Tables[0].Rows.Count > 0)
  159. {
  160. return DataRowToModel(ds.Tables[0].Rows[0]);
  161. }
  162. else
  163. {
  164. return null;
  165. }
  166. }
  167. /// <summary>
  168. /// 得到一个对象实体
  169. /// </summary>
  170. public Model.T_Data_Assessment DataRowToModel(DataRow row)
  171. {
  172. Model.T_Data_Assessment model = new Model.T_Data_Assessment();
  173. if (row != null)
  174. {
  175. if (row["F_Id"] != null && row["F_Id"].ToString() != "")
  176. {
  177. model.F_Id = int.Parse(row["F_Id"].ToString());
  178. }
  179. if (row["F_DeptId"] != null && row["F_DeptId"].ToString() != "")
  180. {
  181. model.F_DeptId = int.Parse(row["F_DeptId"].ToString());
  182. }
  183. if (row["F_DeptName"] != null && row["F_DeptName"].ToString() != "")
  184. {
  185. model.F_DeptName = row["F_DeptName"].ToString();
  186. }
  187. if (row["F_PartentId"] != null && row["F_PartentId"].ToString() != "")
  188. {
  189. model.F_PartentId = int.Parse(row["F_PartentId"].ToString());
  190. }
  191. if (row["F_BatchNo"] != null && row["F_BatchNo"].ToString() != "")
  192. {
  193. model.F_BatchNo = row["F_BatchNo"].ToString();
  194. }
  195. if (row["F_CS_ReciveCount"] != null && row["F_CS_ReciveCount"].ToString() != "")
  196. {
  197. model.F_CS_ReciveCount = int.Parse(row["F_CS_ReciveCount"].ToString());
  198. }
  199. if (row["F_CS_RecTimelyCount"] != null && row["F_CS_RecTimelyCount"].ToString() != "")
  200. {
  201. model.F_CS_RecTimelyCount = int.Parse(row["F_CS_RecTimelyCount"].ToString());
  202. }
  203. if (row["F_JB_AssginCount"] != null && row["F_JB_AssginCount"].ToString() != "")
  204. {
  205. model.F_JB_AssginCount = int.Parse(row["F_JB_AssginCount"].ToString());
  206. }
  207. if (row["F_JB_HandleCount"] != null && row["F_JB_HandleCount"].ToString() != "")
  208. {
  209. model.F_JB_HandleCount = int.Parse(row["F_JB_HandleCount"].ToString());
  210. }
  211. if (row["F_JB_HandleOverCount"] != null && row["F_JB_HandleOverCount"].ToString() != "")
  212. {
  213. model.F_JB_HandleOverCount = int.Parse(row["F_JB_HandleOverCount"].ToString());
  214. }
  215. if (row["F_HF_VisitCount"] != null && row["F_HF_VisitCount"].ToString() != "")
  216. {
  217. model.F_HF_VisitCount = int.Parse(row["F_HF_VisitCount"].ToString());
  218. }
  219. if (row["F_HF_SatisfiedCount"] != null && row["F_HF_SatisfiedCount"].ToString() != "")
  220. {
  221. model.F_HF_SatisfiedCount = int.Parse(row["F_HF_SatisfiedCount"].ToString());
  222. }
  223. if (row["F_HF_DissatisfiedCount"] != null && row["F_HF_DissatisfiedCount"].ToString() != "")
  224. {
  225. model.F_HF_DissatisfiedCount = int.Parse(row["F_HF_DissatisfiedCount"].ToString());
  226. }
  227. if (row["F_TH_BackCount"] != null && row["F_TH_BackCount"].ToString() != "")
  228. {
  229. model.F_TH_BackCount = int.Parse(row["F_TH_BackCount"].ToString());
  230. }
  231. if (row["F_TH_BackTimelyCount"] != null && row["F_TH_BackTimelyCount"].ToString() != "")
  232. {
  233. model.F_TH_BackTimelyCount = int.Parse(row["F_TH_BackTimelyCount"].ToString());
  234. }
  235. if (row["F_ZSK_ActualCount"] != null && row["F_ZSK_ActualCount"].ToString() != "")
  236. {
  237. model.F_ZSK_ActualCount = int.Parse(row["F_ZSK_ActualCount"].ToString());
  238. }
  239. if (row["F_ZSK_ShouldCount"] != null && row["F_ZSK_ShouldCount"].ToString() != "")
  240. {
  241. model.F_ZSK_ShouldCount = int.Parse(row["F_ZSK_ShouldCount"].ToString());
  242. }
  243. if (row["F_ZSK_CorrCount"] != null && row["F_ZSK_CorrCount"].ToString() != "")
  244. {
  245. model.F_ZSK_CorrCount = int.Parse(row["F_ZSK_CorrCount"].ToString());
  246. }
  247. if (row["F_GF_NonstandardCount"] != null && row["F_GF_NonstandardCount"].ToString() != "")
  248. {
  249. model.F_GF_NonstandardCount = int.Parse(row["F_GF_NonstandardCount"].ToString());
  250. }
  251. if (row["F_TB_BulletinOrderCount"] != null && row["F_TB_BulletinOrderCount"].ToString() != "")
  252. {
  253. model.F_TB_BulletinOrderCount = int.Parse(row["F_TB_BulletinOrderCount"].ToString());
  254. }
  255. if (row["F_TB_BulletinCount"] != null && row["F_TB_BulletinCount"].ToString() != "")
  256. {
  257. model.F_TB_BulletinCount = int.Parse(row["F_TB_BulletinCount"].ToString());
  258. }
  259. if (row["F_DF_CSCore"] != null && row["F_DF_CSCore"].ToString() != "")
  260. {
  261. model.F_DF_CSCore = decimal.Parse(row["F_DF_CSCore"].ToString());
  262. }
  263. if (row["F_DF_THCore"] != null && row["F_DF_THCore"].ToString() != "")
  264. {
  265. model.F_DF_THCore = decimal.Parse(row["F_DF_THCore"].ToString());
  266. }
  267. if (row["F_DF_BLCore"] != null && row["F_DF_BLCore"].ToString() != "")
  268. {
  269. model.F_DF_BLCore = decimal.Parse(row["F_DF_BLCore"].ToString());
  270. }
  271. if (row["F_DF_HFCore"] != null && row["F_DF_HFCore"].ToString() != "")
  272. {
  273. model.F_DF_HFCore = decimal.Parse(row["F_DF_HFCore"].ToString());
  274. }
  275. if (row["F_DF_ZSKCore"] != null && row["F_DF_ZSKCore"].ToString() != "")
  276. {
  277. model.F_DF_ZSKCore = decimal.Parse(row["F_DF_ZSKCore"].ToString());
  278. }
  279. if (row["F_DF_GFCore"] != null && row["F_DF_GFCore"].ToString() != "")
  280. {
  281. model.F_DF_GFCore = decimal.Parse(row["F_DF_GFCore"].ToString());
  282. }
  283. if (row["F_DF_TBCore"] != null && row["F_DF_TBCore"].ToString() != "")
  284. {
  285. model.F_DF_TBCore = decimal.Parse(row["F_DF_TBCore"].ToString());
  286. }
  287. if (row["F_DF_ZJ"] != null && row["F_DF_ZJ"].ToString() != "")
  288. {
  289. model.F_DF_ZJ = decimal.Parse(row["F_DF_ZJ"].ToString());
  290. }
  291. if (row["F_SSLimittime"] != null && row["F_SSLimittime"].ToString() != "")
  292. {
  293. model.F_SSLimittime = DateTime.Parse(row["F_SSLimittime"].ToString());
  294. }
  295. if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
  296. {
  297. model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
  298. }
  299. }
  300. return model;
  301. }
  302. /// <summary>
  303. /// 获得数据列表
  304. /// </summary>
  305. public DataSet GetList(string strWhere)
  306. {
  307. StringBuilder strSql = new StringBuilder();
  308. strSql.Append("select * ");
  309. strSql.Append(" FROM T_Data_Assessment ");
  310. if (strWhere.Trim() != "")
  311. {
  312. strSql.Append(" where " + strWhere);
  313. }
  314. return DbHelperSQL.Query(strSql.ToString());
  315. }
  316. /// <summary>
  317. /// 获得前几行数据
  318. /// </summary>
  319. public DataSet GetList(int Top, string strWhere, string filedOrder)
  320. {
  321. StringBuilder strSql = new StringBuilder();
  322. strSql.Append("select ");
  323. if (Top > 0)
  324. {
  325. strSql.Append(" top " + Top.ToString());
  326. }
  327. strSql.Append(" * ");
  328. strSql.Append(" FROM T_Data_Assessment ");
  329. if (strWhere.Trim() != "")
  330. {
  331. strSql.Append(" where " + strWhere);
  332. }
  333. strSql.Append(" order by " + filedOrder);
  334. return DbHelperSQL.Query(strSql.ToString());
  335. }
  336. /// <summary>
  337. /// 获取记录总数
  338. /// </summary>
  339. public int GetRecordCount(string strWhere)
  340. {
  341. StringBuilder strSql = new StringBuilder();
  342. strSql.Append("select count(1) FROM T_Data_Assessment ");
  343. if (strWhere.Trim() != "")
  344. {
  345. strSql.Append(" where " + strWhere);
  346. }
  347. object obj = DbHelperSQL.GetSingle(strSql.ToString());
  348. if (obj == null)
  349. {
  350. return 0;
  351. }
  352. else
  353. {
  354. return Convert.ToInt32(obj);
  355. }
  356. }
  357. /// <summary>
  358. /// 分页获取数据列表
  359. /// </summary>
  360. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  361. {
  362. StringBuilder strSql = new StringBuilder();
  363. strSql.Append("SELECT * FROM ( ");
  364. strSql.Append(" SELECT ROW_NUMBER() OVER (");
  365. if (!string.IsNullOrEmpty(orderby.Trim()))
  366. {
  367. strSql.Append("order by T." + orderby);
  368. }
  369. else
  370. {
  371. strSql.Append("order by T.F_Id desc");
  372. }
  373. strSql.Append(")AS Row, T.* from T_Data_Assessment T ");
  374. if (!string.IsNullOrEmpty(strWhere.Trim()))
  375. {
  376. strSql.Append(" WHERE " + strWhere);
  377. }
  378. strSql.Append(" ) TT");
  379. strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
  380. return DbHelperSQL.Query(strSql.ToString());
  381. }
  382. #endregion Method
  383. }
  384. }