sync.notice.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using BizCom;
  2. using SQLData;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. namespace SiteCore.Handler
  7. {
  8. public partial class sync
  9. {
  10. //通知接口---------------------------------------------
  11. public void get_erp_noticelist()
  12. {
  13. DataStruct dStruct = GetPostStruct();
  14. List<string> lw = new List<string>();
  15. string date1 = GetPostString("date1");
  16. string date2 = GetPostString("date2");
  17. string dw = GetDateMinuteWhere("NoticeTime", date1, date2);
  18. if (dw.Length > 0) lw.Add(dw);
  19. string title = GetPostString("title");
  20. if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
  21. lw.Add(string.Format("uid={0}", CurrentUser.UserID));
  22. dStruct.Order = "ID desc";
  23. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  24. DataTable dt = WebCache.GetData("view_ErpNoticeCell", dStruct);
  25. writeGridDataTableJson(dStruct.TotalCount, dt);
  26. }
  27. public void get_erp_edit_noticelist()
  28. {
  29. DataStruct dStruct = GetPostStruct();
  30. List<string> lw = new List<string>();
  31. string date1 = GetPostString("date1");
  32. string date2 = GetPostString("date2");
  33. string dw = GetDateMinuteWhere("NoticeTime", date1, date2);
  34. if (dw.Length > 0) lw.Add(dw);
  35. string title = GetPostString("title");
  36. if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
  37. if (CurrentUser.UserPost.Post.Code != "SysAdmin")
  38. {
  39. lw.Add(string.Format("senderId={0}", CurrentUser.UserID));
  40. }
  41. dStruct.Order = "ID desc";
  42. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  43. DataTable dt = WebCache.GetData("view_ErpNotice", dStruct);
  44. writeGridDataTableJson(dStruct.TotalCount, dt);
  45. }
  46. public void add_erp_notice()
  47. {
  48. string id = GetPostString("id");
  49. CeErpNotice Nt = null;
  50. if (id.Length > 0)
  51. {
  52. Nt = CeErpNotice.Get(id);
  53. }
  54. else
  55. {
  56. Nt = new CeErpNotice();
  57. }
  58. string title = GetPostString("title");
  59. string con = GetPostString("con");
  60. string noticeTime = GetPostString("noticeTime");
  61. string receiver = GetPostString("receiver");
  62. string receiverStr = GetPostString("receiverStr");
  63. Nt.Title = title;
  64. Nt.NoticeType = GetPostString("noticeType");
  65. Nt.Con = con;
  66. Nt.NoticeTime = Convert.ToDateTime(noticeTime);
  67. Nt.CreatedTime = DateTime.Now;
  68. Nt.Receiver = receiver;
  69. Nt.ReceiverStr = receiverStr;
  70. Nt.senderId = CurrentUser.UserID;
  71. if (id.Length > 0)
  72. {
  73. Nt.Update();
  74. CeErpNoticeCell.DelByNid(Nt.ID);
  75. }
  76. else
  77. {
  78. Nt.Create();
  79. }
  80. //StringBuilder sql = new StringBuilder();
  81. //sql.AppendFormat("select * from view_erpuser where OrgID in ({0})", receiverOrg);
  82. //DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
  83. //if (dt.Rows.Count > 0)
  84. //{
  85. string[] idList = receiver.Split(',');
  86. foreach (string iditem in idList)
  87. {
  88. if (iditem.IndexOf("o") != -1) continue;
  89. CeErpNoticeCell ntcell = new CeErpNoticeCell();
  90. ntcell.nid = Nt.ID;
  91. ntcell.uid = Convert.ToInt32(iditem);
  92. ntcell.Create();
  93. }
  94. //}
  95. returnSuccessMsg("添加成功");
  96. return;
  97. }
  98. public void get_notice_user()
  99. {
  100. string sql = "select * from view_ErpUser where isOpen=1";
  101. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  102. returnSuccess(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  103. }
  104. public void set_erp_readnotice()
  105. {
  106. if (UrlPostParmsCheck("ids"))
  107. {
  108. string ids = GetPostString("ids");
  109. string[] idList = ids.Split(',');
  110. foreach (string id in idList)
  111. {
  112. if (id == "") continue;
  113. CeErpNoticeCell ntcell = CeErpNoticeCell.Get(id);
  114. if (ntcell != null)
  115. {
  116. ntcell.IsRead = 1;
  117. ntcell.ReadTime = DateTime.Now;
  118. ntcell.Update();
  119. }
  120. }
  121. returnSuccessMsg("操作成功");
  122. return;
  123. }
  124. returnErrorMsg("缺少必要参数");
  125. }
  126. public void del_erp_notice()
  127. {
  128. if (UrlPostParmsCheck("id"))
  129. {
  130. string id = GetPostString("id");
  131. CeErpNotice.Del(id);
  132. CeErpNoticeCell.DelByNid(id);
  133. returnSuccessMsg("操作成功");
  134. return;
  135. }
  136. returnErrorMsg("缺少必要参数");
  137. }
  138. public void sel_erp_checkreadnotice()
  139. {
  140. if (UrlPostParmsCheck("id"))
  141. {
  142. DataStruct dStruct = GetPostStruct();
  143. List<string> lw = new List<string>();
  144. int id = GetPostInt("id");
  145. lw.Add(string.Format("nid={0}", id));
  146. dStruct.Order = "ID desc";
  147. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  148. DataTable dt = WebCache.GetData("view_ErpNoticeCell", dStruct);
  149. writeGridDataTableJson(dStruct.TotalCount, dt);
  150. }
  151. }
  152. //获取流程列表接口---------------------------------------------
  153. public void get_erp_processlist()
  154. {
  155. string posCode = CurrentUser.UserPost.Post.Code;
  156. int orgId = CurrentUser.UserPost.OrgID;
  157. DataStruct dStruct = GetPostStruct();
  158. List<string> lw = new List<string>();
  159. string date1 = GetPostString("date1");
  160. string date2 = GetPostString("date2");
  161. string dw = GetDateMinuteWhere("CreatedTime", date1, date2);
  162. if (dw.Length > 0) lw.Add(dw);
  163. string title = GetPostString("title");
  164. if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
  165. if (posCode != "SysAdmin")
  166. {
  167. lw.Add(string.Format("OrgId={0}", orgId));
  168. }
  169. dStruct.Order = "ID desc";
  170. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  171. DataTable dt = WebCache.GetData("view_ErpProcessList", dStruct);
  172. writeGridDataTableJson(dStruct.TotalCount, dt);
  173. }
  174. //流程添加--------------------------------------------
  175. public void add_erp_process()
  176. {
  177. string id = GetPostString("id");
  178. /*CeErpProcessList Nt = null;
  179. if (id.Length > 0)
  180. {
  181. Nt = CeErpProcessList.Get(id);
  182. if (Nt.CreateUserId != CurrentUser.UserID)
  183. {
  184. returnErrorMsg("此流程添加者才能修改");
  185. return;
  186. }
  187. }
  188. else
  189. {
  190. Nt = new CeErpProcessList();
  191. }
  192. string title = GetPostString("title");
  193. string con = GetPostString("con");
  194. Nt.OrgId = GetPostInt("orgid");
  195. Nt.Title = title;
  196. Nt.Con = con;
  197. Nt.CreatedTime = DateTime.Now;
  198. Nt.CreateUserId = CurrentUser.UserID;
  199. if (id.Length > 0)
  200. {
  201. Nt.Update();
  202. }
  203. else
  204. {
  205. Nt.Create();
  206. }*/
  207. returnSuccessMsg("添加成功");
  208. return;
  209. }
  210. public void del_erp_process()
  211. {
  212. if (UrlPostParmsCheck("id"))
  213. {
  214. string id = GetPostString("id");
  215. //CeErpProcessList Nt = null;
  216. if (id.Length > 0)
  217. {
  218. /*Nt = CeErpProcessList.Get(id);
  219. if (Nt.CreateUserId != CurrentUser.UserID)
  220. {
  221. returnErrorMsg("此流程添加者才能删除");
  222. return;
  223. }
  224. CeErpProcessList.Del(id);*/
  225. returnSuccessMsg("操作成功");
  226. return;
  227. }
  228. }
  229. returnErrorMsg("缺少必要参数");
  230. }
  231. }
  232. }