123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- using LYFZ.ComponentLibrary;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.Dresses.DressManagement
- {
- public partial class FrmPreselected : LYFZ.Software.UI.Dresses.DressManagement.FrmPreselected
- {
- private delegate void UpdateControl();
- public string type;
- public string Number;
- public FrmPreselected()
- {
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- }
- #region 加载
- protected override void FrmPreselected_Shown(object sender, EventArgs e)
- {
-
- try
- {
- if (type == "0")
- {
- btnSelect.Visible = true;
- }
- bind();
-
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(ex.Message);
-
- }
- }
- #region 获取礼服订单
- /// <summary>
- /// 获取礼服订单
- /// </summary>
- public void bind()
- {
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.PageSize = 100;
- this.ucPagerEx1.Bind();
- }
- #endregion
- #endregion
- #region 查询
- protected override void btnSlect_Click(object sender, EventArgs e)
- {
-
- try
- {
- bind();
-
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(ex.Message);
- }
- }
- #endregion
- #region 更新
- protected override void btnUpdate_Click(object sender, EventArgs e)
- {
- if (dgv.SelectedRows.Count == 0)
- {
- MessageBoxCustom.Show("请选择你要修改的礼服订单");
- return;
- }
- LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmPreselectedUpdate set = new FrmPreselectedUpdate();
- set.Dsro_Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
- if (set.ShowDialog() == DialogResult.OK)
- {
- bind();
- }
- }
- #endregion
- #region 删除
- protected override void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgv.SelectedRows.Count == 0)
- {
- MessageBoxCustom.Show("请选中你要删除的数据!");
- return;
- }
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- LYFZ.BLL.BLL_ErpDressSaleRentalOrder bll = new BLL.BLL_ErpDressSaleRentalOrder();
- string Dsro_Number = this.dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
- if (bll.DeleteLf(Dsro_Number)==1)
- {
- #region 写入操作日志
- string logsContent = "删除预选礼服编号:" + Dsro_Number;
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除礼服, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- //LYFZ.BLL.BLL_ErpSystemLogs systemLogsBll = new BLL.BLL_ErpSystemLogs();
- //LYFZ.Model.Model_ErpSystemLogs systemLogsModel = new Model.Model_ErpSystemLogs();
- //systemLogsModel.Slogs_Type = "user";
- //systemLogsModel.Slogs_Topic = "删除预选礼服";
- //systemLogsModel.Slogs_Content = "删除预选礼服编号:" + Dsro_Number;
- //systemLogsModel.Slogs_UserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- //systemLogsModel.Slogs_IP = "";
- //systemLogsModel.Slogs_CreateDatetime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
- //systemLogsModel.Slogs_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- //systemLogsBll.Add(systemLogsModel);
- #endregion
- MessageBoxCustom.Show("删除成功!");
- bind();
- }
- else { MessageBoxCustom.Show("删除失败!"); }
- }
- }
- #endregion
- #region 选择
- protected override void btnSelect_Click(object sender, EventArgs e)
- {
- if(dgv.SelectedRows.Count==0)
- {
- MessageBoxCustom.Show("请选择礼服订单!");
- return;
- }
- Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
- this.Close();
- }
- protected override void dgv_DoubleClick(object sender, EventArgs e)
- {
- if (dgv.SelectedRows.Count == 0)
- {
- MessageBoxCustom.Show("请选择礼服订单!");
- return;
- }
- Number = dgv.CurrentRow.Cells["Dsro_Number"].Value.ToString();
- this.Close();
- }
- #endregion
- #region 画分页
- /// <summary>
- /// 画分页
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- dgv.Rows.Clear();
- LYFZ.BLL.BLL_ErpDressFrom DressFrombll = new BLL.BLL_ErpDressFrom();
- DataTable dt = new DataTable();
- StringBuilder sql = new StringBuilder();
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- if (!string.IsNullOrEmpty(txtkeyword.Text))
- {
- 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'");
- }
- else
- {
- sql.Append(" 1=1 and Dsro_Type='2'");
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- pageData.TableName = "View_DressSaleRentalOrder";
- pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- pageData.PageSize = this.ucPagerEx1.PageSize;
- pageData.QueryCondition = sql.ToString();
- 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";
- pageData.OrderStr = "ID desc";
- pageData.OrderType = 1;
- DataSet da = pageData.QueryDataTable();
- dt = da.Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.Invoke(new UpdateControl(delegate()
- {
- #region 获取预选衣服
- for (int t = 0; t < dt.Rows.Count; t++)
- {
- #region
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["ID"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Dsro_Number"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_Telephone"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = Convert.ToDateTime( dt.Rows[t]["Dsro_CreateDateTime"]).ToString("yyyy-MM-dd").Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- LYFZ.BLL.BLL_ErpUser UserBll = new BLL.BLL_ErpUser();
- cell.Value = UserBll.GetUserName(dt.Rows[t]["Dsro_CreateName"].ToString().Trim());
- dgvr.Cells.Add(cell);
- this.dgv.Rows.Add(dgvr);
- dgv.ClearSelection();
- #endregion
- }
- #endregion
- }));
- }
- });
- try
- {
- this.ucPagerEx1.TbDataSource = dt;
- }
- catch { }
- return pageData.TotalCount;
- }
- #endregion
- }
- }
|