FrmPreselected.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.Dresses.DressManagement
  11. {
  12. public partial class FrmPreselected : LYFZ.Software.UI.Dresses.DressManagement.FrmPreselected
  13. {
  14. private delegate void UpdateControl();
  15. public string type;
  16. public string Number;
  17. public FrmPreselected()
  18. {
  19. this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
  20. }
  21. #region 加载
  22. protected override void FrmPreselected_Shown(object sender, EventArgs e)
  23. {
  24. try
  25. {
  26. if (type == "0")
  27. {
  28. btnSelect.Visible = true;
  29. }
  30. bind();
  31. }
  32. catch (Exception ex)
  33. {
  34. MessageBoxCustom.Show(ex.Message);
  35. }
  36. }
  37. #region 获取礼服订单
  38. /// <summary>
  39. /// 获取礼服订单
  40. /// </summary>
  41. public void bind()
  42. {
  43. this.ucPagerEx1.PageCurrent = 1;
  44. this.ucPagerEx1.PageSize = 100;
  45. this.ucPagerEx1.Bind();
  46. }
  47. #endregion
  48. #endregion
  49. #region 查询
  50. protected override void btnSlect_Click(object sender, EventArgs e)
  51. {
  52. try
  53. {
  54. bind();
  55. }
  56. catch (Exception ex)
  57. {
  58. MessageBoxCustom.Show(ex.Message);
  59. }
  60. }
  61. #endregion
  62. #region 更新
  63. protected override void btnUpdate_Click(object sender, EventArgs e)
  64. {
  65. if (dgv.SelectedRows.Count == 0)
  66. {
  67. MessageBoxCustom.Show("请选择你要修改的礼服订单");
  68. return;
  69. }
  70. LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmPreselectedUpdate set = new FrmPreselectedUpdate();
  71. set.Dsro_Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
  72. if (set.ShowDialog() == DialogResult.OK)
  73. {
  74. bind();
  75. }
  76. }
  77. #endregion
  78. #region 删除
  79. protected override void btnDelete_Click(object sender, EventArgs e)
  80. {
  81. if (this.dgv.SelectedRows.Count == 0)
  82. {
  83. MessageBoxCustom.Show("请选中你要删除的数据!");
  84. return;
  85. }
  86. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  87. {
  88. LYFZ.BLL.BLL_ErpDressSaleRentalOrder bll = new BLL.BLL_ErpDressSaleRentalOrder();
  89. string Dsro_Number = this.dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
  90. if (bll.DeleteLf(Dsro_Number)==1)
  91. {
  92. #region 写入操作日志
  93. string logsContent = "删除预选礼服编号:" + Dsro_Number;
  94. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除礼服, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  95. //LYFZ.BLL.BLL_ErpSystemLogs systemLogsBll = new BLL.BLL_ErpSystemLogs();
  96. //LYFZ.Model.Model_ErpSystemLogs systemLogsModel = new Model.Model_ErpSystemLogs();
  97. //systemLogsModel.Slogs_Type = "user";
  98. //systemLogsModel.Slogs_Topic = "删除预选礼服";
  99. //systemLogsModel.Slogs_Content = "删除预选礼服编号:" + Dsro_Number;
  100. //systemLogsModel.Slogs_UserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  101. //systemLogsModel.Slogs_IP = "";
  102. //systemLogsModel.Slogs_CreateDatetime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  103. //systemLogsModel.Slogs_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  104. //systemLogsBll.Add(systemLogsModel);
  105. #endregion
  106. MessageBoxCustom.Show("删除成功!");
  107. bind();
  108. }
  109. else { MessageBoxCustom.Show("删除失败!"); }
  110. }
  111. }
  112. #endregion
  113. #region 选择
  114. protected override void btnSelect_Click(object sender, EventArgs e)
  115. {
  116. if(dgv.SelectedRows.Count==0)
  117. {
  118. MessageBoxCustom.Show("请选择礼服订单!");
  119. return;
  120. }
  121. Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
  122. this.Close();
  123. }
  124. protected override void dgv_DoubleClick(object sender, EventArgs e)
  125. {
  126. if (dgv.SelectedRows.Count == 0)
  127. {
  128. MessageBoxCustom.Show("请选择礼服订单!");
  129. return;
  130. }
  131. Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
  132. this.Close();
  133. }
  134. #endregion
  135. #region 画分页
  136. /// <summary>
  137. /// 画分页
  138. /// </summary>
  139. /// <param name="e"></param>
  140. /// <returns></returns>
  141. private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
  142. {
  143. dgv.Rows.Clear();
  144. LYFZ.BLL.BLL_ErpDressFrom DressFrombll = new BLL.BLL_ErpDressFrom();
  145. DataTable dt = new DataTable();
  146. StringBuilder sql = new StringBuilder();
  147. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  148. if (!string.IsNullOrEmpty(txtkeyword.Text))
  149. {
  150. sql.Append(" 1=1 and (Dsro_Number like '%" + txtkeyword.Text.Trim() + "%' or Cus_Name like '%" + txtkeyword.Text.Trim() + "%' or Cus_Telephone like '%" + txtkeyword.Text.Trim() + "%') and Dsro_Type='2'");
  151. }
  152. else
  153. {
  154. sql.Append(" 1=1 and Dsro_Type='2'");
  155. }
  156. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  157. {
  158. pageData.TableName = "View_DressSaleRentalOrder";
  159. pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  160. pageData.PageSize = this.ucPagerEx1.PageSize;
  161. pageData.QueryCondition = sql.ToString();
  162. pageData.QueryFieldName = "ID,Dsro_Number,Dsro_Type,Dsro_Amount,Dsro_MortgageAmount,Dsro_CustomerNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime,Dsro_Remark,Dsro_CreateDateTime,Dsro_CreateName,Dsro_UpdateDateTime,Dsro_UpdateName,Cus_CustomerNumber,Cus_CustomizeNumber,Cus_Type,Cus_ServiceType,Cus_Grade,Cus_Name,Cus_Sex,Cus_Birthday,Cus_BirthdayLunar,Cus_DayForMarriage,Cus_DayForMarriageLunar,Cus_Relations,Cus_QQ,Cus_MicroSignal,Cus_Telephone,Py_Cus_Name";
  163. pageData.OrderStr = "ID desc";
  164. pageData.OrderType = 1;
  165. DataSet da = pageData.QueryDataTable();
  166. dt = da.Tables[0];
  167. if (dt.Rows.Count > 0)
  168. {
  169. this.Invoke(new UpdateControl(delegate()
  170. {
  171. #region 获取预选衣服
  172. for (int t = 0; t < dt.Rows.Count; t++)
  173. {
  174. #region
  175. DataGridViewRow dgvr = new DataGridViewRow();
  176. DataGridViewCell cell = null;
  177. cell = new DataGridViewTextBoxCell();
  178. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  179. dgvr.Cells.Add(cell);
  180. cell = new DataGridViewTextBoxCell();
  181. cell.Value = dt.Rows[t]["Dsro_Number"].ToString().Trim();
  182. dgvr.Cells.Add(cell);
  183. cell = new DataGridViewTextBoxCell();
  184. cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim();
  185. dgvr.Cells.Add(cell);
  186. cell = new DataGridViewTextBoxCell();
  187. cell.Value = dt.Rows[t]["Cus_Telephone"].ToString().Trim();
  188. dgvr.Cells.Add(cell);
  189. cell = new DataGridViewTextBoxCell();
  190. cell.Value = Convert.ToDateTime( dt.Rows[t]["Dsro_CreateDateTime"]).ToString("yyyy-MM-dd").Trim();
  191. dgvr.Cells.Add(cell);
  192. cell = new DataGridViewTextBoxCell();
  193. LYFZ.BLL.BLL_ErpUser UserBll = new BLL.BLL_ErpUser();
  194. cell.Value = UserBll.GetUserName(dt.Rows[t]["Dsro_CreateName"].ToString().Trim());
  195. dgvr.Cells.Add(cell);
  196. this.dgv.Rows.Add(dgvr);
  197. dgv.ClearSelection();
  198. #endregion
  199. }
  200. #endregion
  201. }));
  202. }
  203. });
  204. try
  205. {
  206. this.ucPagerEx1.TbDataSource = dt;
  207. }
  208. catch { }
  209. return pageData.TotalCount;
  210. }
  211. #endregion
  212. }
  213. }