//往来单位2选择器 private void txtcCustName2_ChooserClick(object sender, EventArgs e) { if (CommonCtrl.IsNullToString(cboOrderType.SelectedValue) == "") { return; } DataSources.EnumAccountVerification enumAccount = (DataSources.EnumAccountVerification)Convert.ToInt32(cboOrderType.SelectedValue); switch (enumAccount) { case DataSources.EnumAccountVerification.YuShouToYingShou: //预收冲应收 case DataSources.EnumAccountVerification.YingShouToYingShou: //应收转应收 case DataSources.EnumAccountVerification.YingFuToYingShou: //应付冲应收 case DataSources.EnumAccountVerification.YuShouToYuShou: //预收转预收 frmCustomerInfo frmCustomer = new frmCustomerInfo(); if (frmCustomer.ShowDialog() == DialogResult.OK) { txtcCustName2.Tag = frmCustomer.strCustomerId; txtcCustName2.Text = frmCustomer.strCustomerName; } break; case DataSources.EnumAccountVerification.YuFuToYingFu: //预付冲应付 case DataSources.EnumAccountVerification.YingFuToYingFu: //应付转应付 case DataSources.EnumAccountVerification.YingShouToYingFu: //应收冲应付 case DataSources.EnumAccountVerification.YuFuToYuFu: //预付转预付 frmSupplier frmSupp = new frmSupplier(); if (frmSupp.ShowDialog() == DialogResult.OK) { txtcCustName2.Tag = frmSupp.supperID; txtcCustName2.Text = frmSupp.supperName; } break; } }
private void InitQueryControlDataSource() //初始化查询控件数据项 { dtp_repairs_time_s.Value = DateTime.Now.AddMonths(-1); dtp_repairs_time_e.Value = DateTime.Now.AddDays(1); dtp_approval_date_s.Value = DateTime.Now.AddMonths(-1); dtp_approval_date_e.Value = DateTime.Now.AddDays(1); txt_vehicle_no.ChooserClick += delegate //车牌号 { var vechicleChooser = new frmVehicleGrade(); var result = vechicleChooser.ShowDialog(); if (result != DialogResult.OK) { return; } txt_vehicle_no.Text = vechicleChooser.strLicensePlate; }; txt_customer_code.ChooserClick += delegate //客户编码(同时会更新客户名称) { var custChooser = new frmCustomerInfo(); var result = custChooser.ShowDialog(); if (result != DialogResult.OK) { return; } txt_customer_code.Text = custChooser.strCustomerNo; txt_customer_name.Caption = custChooser.strCustomerName; }; CommonCtrl.CmbBindDict(cbo_bill_type_yt, "bill_type_yt", true); //单据类型 CommonCtrl.CmbBindDict(cbo_info_status, "sys_service_info_status", true); //单据状态 CommonCtrl.CmbBindDict(cbo_approve_status_yt, "review_status_name_yt", true); //宇通单据状态 }
private void InitQueryControlDataSource() //初始化查询控件数据项 { if ((fld_vehicle_no.ValueControl as ExtTextChooser) != null) { (fld_vehicle_no.ValueControl as ExtTextChooser).ChooserClick += delegate //车牌号 { var vechicleChooser = new frmVehicleGrade(); var result = vechicleChooser.ShowDialog(); if (result != DialogResult.OK) { return; } fld_vehicle_no.Value = fld_vehicle_no.DisplayValue = vechicleChooser.strLicensePlate; }; } if ((fld_customer_code.ValueControl as ExtTextChooser) != null) { (fld_customer_code.ValueControl as ExtTextChooser).ChooserClick += delegate //客户编码(同时会更新客户名称) { var custChooser = new frmCustomerInfo(); var result = custChooser.ShowDialog(); if (result != DialogResult.OK) { return; } fld_customer_code.DisplayValue = custChooser.strCustomerNo; fld_customer_code.Value = custChooser.strCustomerName; }; } fld_info_status.ContentTypeName = fld_info_status_yt.ContentTypeName = fld_receipt_type.ContentTypeName = "DbDic"; fld_info_status.ContentTypeParameter = "sys_service_info_status"; //单据状态 fld_info_status_yt.ContentTypeParameter = "review_status_name_yt"; //宇通单据状态 fld_receipt_type.ContentTypeParameter = "bill_type_yt"; //单据类型 }
private void txtcPickingPeople_ChooserClick(object sender, EventArgs e) { frmCustomerInfo customerInfo = new frmCustomerInfo(); if (customerInfo.ShowDialog() == DialogResult.OK) { txtcPickingPeople.Text = customerInfo.strCustomerName; } }
//客户选择 private void txtcCust_code_ChooserClick(object sender, EventArgs e) { frmCustomerInfo frmCust = new frmCustomerInfo(); if (frmCust.ShowDialog() == DialogResult.OK) { txtcCust_code.Text = frmCust.strCustomerNo; txtCust_name.Caption = frmCust.strCustomerName; } }
/// <summary> 选择客户编码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void txtcust_code_ChooserClick(object sender, EventArgs e) { frmCustomerInfo chooseSupplier = new frmCustomerInfo(); chooseSupplier.ShowDialog(); if (!string.IsNullOrEmpty(chooseSupplier.strCustomerId)) { txtcust_code.Text = chooseSupplier.strCustomerNo; txtcust_name.Caption = chooseSupplier.strCustomerName; } }
private void txtCustomNO_ChooserClick(object sender, EventArgs e) { frmCustomerInfo frmCInfo = new frmCustomerInfo(); DialogResult result = frmCInfo.ShowDialog(); if (result == DialogResult.OK) { txtCustomNO.Text = frmCInfo.strCustomerName; txtCustomNO.Tag = frmCInfo.strCustomerId; } }
/// <summary> 选择客户名称 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtcus_name_ChooserClick(object sender, EventArgs e) { frmCustomerInfo chooseSupplier = new frmCustomerInfo(); chooseSupplier.ShowDialog(); string supperID = chooseSupplier.strCustomerId; if (!string.IsNullOrEmpty(supperID)) { txtcus_name.Text = chooseSupplier.strCustomerName; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtcust_code_ChooserClick(object sender, EventArgs e) { frmCustomerInfo chooseSupplier = new frmCustomerInfo(); chooseSupplier.ShowDialog(); string cust_id = chooseSupplier.strCustomerId; if (!string.IsNullOrEmpty(cust_id)) { txtcust_code.Text = chooseSupplier.strCustomerNo; } }
/// <summary> /// 按配件查询旧件收货单客户编码选择器事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtPCustomCode_ChooserClick(object sender, EventArgs e) { frmCustomerInfo frmCInfo = new frmCustomerInfo(); DialogResult result = frmCInfo.ShowDialog(); if (result == DialogResult.OK) { txtPCustomCode.Text = frmCInfo.strCustomerNo; txtPCustomCode.Tag = frmCInfo.strCustomerId; txtPCustomName.Caption = frmCInfo.strCustomerName; } }
//往来单位1选择器 private void txtcCustName1_ChooserClick(object sender, EventArgs e) { //if (CommonCtrl.IsNullToString(cboOrderType.SelectedValue) == "") //{ // return; //} frmBtype frmUints = new frmBtype(); if (frmUints.ShowDialog() == DialogResult.OK) { txtcCustName1.Text = frmUints.BtypeName; } return; DataSources.EnumAccountVerification enumAccount = (DataSources.EnumAccountVerification)Convert.ToInt32(cboOrderType.SelectedValue); switch (enumAccount) { case DataSources.EnumAccountVerification.YuShouToYingShou: //预收冲应收 case DataSources.EnumAccountVerification.YingShouToYingShou: //应收转应收 case DataSources.EnumAccountVerification.YingShouToYingFu: //应收冲应付 case DataSources.EnumAccountVerification.YuShouToYuShou: //预收转预收 frmCustomerInfo frmCustomer = new frmCustomerInfo(); if (frmCustomer.ShowDialog() == DialogResult.OK) { txtcCustName1.Tag = frmCustomer.strCustomerId; txtcCustName1.Text = frmCustomer.strCustomerName; if (txtcCustName2.Tag == null && enumAccount != DataSources.EnumAccountVerification.YingShouToYingFu) //没有选择应收客户,默认选择与预收客户相同 { txtcCustName2.Tag = frmCustomer.strCustomerId; txtcCustName2.Text = frmCustomer.strCustomerName; } } break; case DataSources.EnumAccountVerification.YuFuToYingFu: //预付冲应付 case DataSources.EnumAccountVerification.YingFuToYingFu: //应付转应付 case DataSources.EnumAccountVerification.YingFuToYingShou: //应付冲应收 case DataSources.EnumAccountVerification.YuFuToYuFu: //预付转预付 frmSupplier frmSupp = new frmSupplier(); if (frmSupp.ShowDialog() == DialogResult.OK) { txtcCustName1.Tag = frmSupp.supperID; txtcCustName1.Text = frmSupp.supperName; if (txtcCustName2.Tag == null && enumAccount != DataSources.EnumAccountVerification.YingFuToYingShou) { txtcCustName2.Tag = frmSupp.supperID; txtcCustName2.Text = frmSupp.supperName; } } break; } }
/// <summary> 选择客户编码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtcust_code2_ChooserClick(object sender, EventArgs e) { frmCustomerInfo chooseSupplier = new frmCustomerInfo(); chooseSupplier.ShowDialog(); if (!string.IsNullOrEmpty(chooseSupplier.strCustomerId)) { txtcust_code2.Text = chooseSupplier.strCustomerNo; txtcust_name2.Caption = chooseSupplier.strCustomerName; DataTable dt = DBHelper.GetTable("查询客户档案信息", "tb_customer", "*", " enable_flag != 0 and cust_id='" + chooseSupplier.strCustomerId + "'", "", ""); if (dt.Rows.Count > 0) { txtcontacts_tel2.Caption = dt.Rows[0]["cust_tel"].ToString(); } } }
/// <summary> /// 领料人选择器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtRFetchOpid_ChooserClick(object sender, EventArgs e) { try { frmCustomerInfo frmCInfo = new frmCustomerInfo(); DialogResult result = frmCInfo.ShowDialog(); if (result == DialogResult.OK) { txtRFetchOpid.Text = frmCInfo.strCustomerName; txtRFetchOpid.Tag = frmCInfo.strCustomerId; } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 客户编码选择器事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtCustomNO_ChooserClick(object sender, EventArgs e) { try { frmCustomerInfo frmCInfo = new frmCustomerInfo(); DialogResult result = frmCInfo.ShowDialog(); if (result == DialogResult.OK) { txtCustomNO.Text = frmCInfo.strCustomerNo; txtCustomNO.Tag = frmCInfo.strCustomerId; txtCustomName.Caption = frmCInfo.strCustomerName; txtContact.Caption = frmCInfo.strLegalPerson; } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void InitQueryControlDataSource() //初始化查询控件数据项 { txt_vehicle_no.ChooserClick += delegate //车牌号 { try { var vechicleChooser = new frmVehicleGrade(); var result = vechicleChooser.ShowDialog(); if (result != DialogResult.OK) { return; } txt_vehicle_no.Text = vechicleChooser.strLicensePlate; } catch (Exception ex) { _loggingService.WriteLog(ex); } }; txt_customer_code.ChooserClick += delegate //客户编码(同时会更新客户名称) { try { var custChooser = new frmCustomerInfo(); var result = custChooser.ShowDialog(); if (result != DialogResult.OK) { return; } txt_customer_code.Text = custChooser.strCustomerNo; txt_customer_name.Caption = custChooser.strCustomerName; } catch (Exception ex) { _loggingService.WriteLog(ex); } }; CommonCtrl.CmbBindDict(cbo_bill_type_yt, "bill_type_yt", true); //单据类型 CommonCtrl.CmbBindDict(cbo_approve_status_yt, "review_status_name_yt", true); //宇通单据状态 }
//选择器 private void txtCustCode_ChooserClick(object sender, EventArgs e) { //应收选择客户 if (orderType == DataSources.EnumOrderType.RECEIVABLE) { frmCustomerInfo frm = new frmCustomerInfo(); if (frm.ShowDialog() == DialogResult.OK) { txtCustCode.Text = frm.strCustomerNo; txtCustName.Caption = frm.strCustomerName; } } else if (orderType == DataSources.EnumOrderType.PAYMENT)//应付选择供应商 { frmSupplier frmSupp = new frmSupplier(); if (frmSupp.ShowDialog() == DialogResult.OK) { txtCustCode.Text = frmSupp.supperCode; txtCustName.Caption = frmSupp.supperName; } } }
//初始化 private void Init() { dgvQData.MultiSelect = false; //不允许多选操作 SetUCBaseFuncationVisible(); #region 初始化时间控件值 dtp_create_time_s.Value = DateTime.Now.AddMonths(-1); dtp_create_time_e.Value = DateTime.Now.AddDays(+1); #endregion #region 初始化下拉框数据绑定 CommonCtrl.BindComboBoxByDictionarr(cbo_member_grade, "sys_member_grade", true); //绑定会员等级 DataSources.BindComBoxDataEnum(cbo_status, typeof(DataSources.EnumStatus), true); //绑定会员状态 #endregion #region 注册功能按钮事件 #region 清除查询条件 btnClear.Click += delegate { txt_vip_code.Caption = String.Empty; cbo_member_grade.SelectedValue = String.Empty; cbo_status.SelectedValue = String.Empty; dtp_create_time_s.Value = DateTime.Now.AddMonths(-1); dtp_create_time_e.Value = DateTime.Now.AddDays(1); txt_cust_name.Text = String.Empty; txt_legal_person.Caption = String.Empty; }; #endregion #region 查询 btnQuery.Click += delegate { BindPageData(); }; #endregion #region 择客户信息 txt_cust_name.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { txt_cust_name.Text = frmCustomer.strCustomerName; txt_cust_name.Tag = frmCustomer.strCustomerId; } }; #endregion #region 数据翻页 pageQ.PageIndexChanged += delegate { BindPageData(); }; #endregion #region 数据表数据选择 dgvQData.CellDoubleClick += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCMemberViewDetail(); uc.OpType = WindowStatus.View; uc.UCMemberManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.VipId = selectedData.Cells["drtxt_vip_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询会员信息", "v_member", "*", "vip_id = '" + uc.VipId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["corp_id"].ToString(); } uc.addUserControl(uc, "会员管理-详细信息", "UCMemberView", Tag.ToString(), Name); } }; #endregion #region 数据表格数据格式化 dgvQData.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args) { UIAssistants.DgvCellDataConvert2Datetime(dgvQData, args, "create_time"); UIAssistants.DgvCellDataConvert2Datetime(dgvQData, args, "validity_time"); UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "member_grade"); UIAssistants.DgvCellDataConvert2Enum(dgvQData, args, "status", typeof(DataSources.EnumStatus)); //状态 }; #endregion #region 新增数据 AddEvent += delegate { var uc = new UCMemberAddOrEdit(); uc.UCMemberManager = this; uc.OpType = WindowStatus.Add; uc.addUserControl(uc, "会员管理-新增", "UCMemberAdd", Tag.ToString(), Name); }; #endregion #region 编辑数据 EditEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCMemberAddOrEdit(); uc.OpType = WindowStatus.Edit; uc.UCMemberManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.VipId = selectedData.Cells["drtxt_vip_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询会员信息", "v_member", "*", "vip_id = '" + uc.VipId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.VipId = callbackInfo.DefaultView[0]["vip_id"].ToString(); uc.CustId = callbackInfo.DefaultView[0]["cust_id"].ToString(); uc.SelectedRow = callbackInfo.DefaultView[0]; } uc.addUserControl(uc, "会员管理-编辑", "UCMemberEdit", Tag.ToString(), Name); } }; #endregion #region 除数据 btnDelete.Click += delegate { try { if (dgvQData.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var listField = (from DataGridViewRow selectedRow in dgvQData.SelectedRows select selectedRow.Cells["drtxt_vip_id"].Value.ToString()).ToList(); var result = MessageBoxEx.Show("此操作将永久删除选定信息。\n若要继续,请单击“确定”。", "您确认要删除此条信息吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { var flag = DBHelper.DeleteDataByID("删除客户回访信息", "tb_CustomerSer_Member", "vip_id", listField[0]); if (flag) { BindPageData(); MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } else { MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }; #endregion #endregion #region 预览 ViewEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCMemberViewDetail(); uc.OpType = WindowStatus.View; uc.UCMemberManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.VipId = selectedData.Cells["drtxt_vip_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询会员信息", "v_member", "*", "vip_id = '" + uc.VipId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["corp_id"].ToString(); } uc.addUserControl(uc, "会员管理-详细信息", "UCMemberView", Tag.ToString(), Name); } }; #endregion #region 启用/禁用 StatusEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var dataView = GetSelectedRowData(); var listField = GetCheckRows(); if (listField.Count >= 1) { if (MessageBoxEx.Show("确认要" + btnStatus.Caption + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } var flag = false; foreach (DataRowView view in dataView) { var status = CommonCtrl.IsNullToString(view[drtxt_status.DataPropertyName]); flag = DBHelper.Submit_AddOrEdit("启用/停用会员状态", "v_member", "vip_id", CommonCtrl.IsNullToString(view[drtxt_vip_id.DataPropertyName]), new Dictionary <string, string> { { "status", status == "1" ? "0" : "1" }, { "update_by", GlobalStaticObj.UserID }, { "update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime).ToString(CultureInfo.InvariantCulture) } }); } MessageBoxEx.Show(btnStatus.Caption + (flag ? "成功!" : "失败!"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } } }; #endregion #region 根据选择的数据判断功能按钮的显示状态 dgvQData.CellMouseUp += delegate { var dataView = GetSelectedRowData(); var listField = GetCheckRows(); btnStatus.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; btnView.Enabled = false; if (dataView == null || listField.Count == 0) { } else { #region 编辑 if (listField.Count == 1) { btnEdit.Enabled = true; btnDelete.Enabled = true; btnView.Enabled = true; } #endregion #region 启用/停用 var qy = 0; var jy = 0; foreach (DataRowView rowView in dataView) //启用/停用 { if (rowView["status"].ToString() == "1") { qy++; } else if (rowView["status"].ToString() == "0") { jy++; } } if (qy == 0 && jy != 0) { btnStatus.Enabled = true; btnStatus.Caption = "启用"; btnStatus.Width = 60; } else if (qy != 0 && jy == 0) { btnStatus.Enabled = true; btnStatus.Caption = "停用"; btnStatus.Width = 60; } else { btnStatus.Enabled = false; btnStatus.Caption = "启用/停用"; btnStatus.Width = 90; } #endregion } }; #endregion BindPageData(); }
//初始化 private void Init() { #region 初始化下拉框数据绑定 CommonCtrl.BindComboBoxByDictionarr(cbo_member_grade, "sys_member_grade", false); //绑定会员等级 #endregion #region 初始化界面控件值 if (OpType == WindowStatus.Add) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnSave, btnExport, btnSet, btnView, btnPrint }); txt_vip_code.Caption = CommonUtility.GetNewNo(DataSources.EnumProjectType.CustomerSer_member); dtp_validity_time.Value = DBHelper.GetCurrentTime(); } if (OpType == WindowStatus.Edit) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnExport, btnSet, btnView, btnPrint }); rtx_remark.Text = SelectedRow["remark"].ToString(); SetCustInfo(); if (!String.IsNullOrEmpty(VipId)) { SetMemberInfo(); } } if (OpType == WindowStatus.View) { UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms> { btnExport, btnSet, btnView, btnPrint }); SetCustInfo(); if (!String.IsNullOrEmpty(VipId)) { SetMemberInfo(); } palQTop.Enabled = false; } #endregion #region 注册功能按钮事件 #region 择客户信息 txt_cust_name.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { CustId = frmCustomer.strCustomerId; } SetCustInfo(); }; #endregion #region 保存数据 SaveEvent += delegate { var check = CheckValue(); if (!check) { return; } var dicFileds = new Dictionary <String, String>(); var dicField4Cust = new Dictionary <String, String>(); if (OpType == WindowStatus.Add) { dicFileds.Add("vip_id", Guid.NewGuid().ToString()); } dicFileds.Add("corp_id", CustId); dicFileds.Add("vip_code", txt_vip_code.Caption); dicFileds.Add("member_grade", cbo_member_grade.SelectedValue.ToString()); dicFileds.Add("remark", rtx_remark.Text); dicFileds.Add("validity_time", dtp_validity_time.Value.Ticks.ToString()); if (OpType == WindowStatus.Add) { dicFileds.Add("create_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("create_time", DBHelper.GetCurrentTime().Ticks.ToString()); dicFileds.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); } else if (OpType == WindowStatus.Edit) { dicFileds.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); } dicFileds.Add("status", "1"); CustId = txt_cust_name.Tag.ToString(); dicField4Cust.Add("is_member", "1"); dicField4Cust.Add("member_number", txt_vip_code.Caption); dicField4Cust.Add("member_class", cbo_member_grade.SelectedValue.ToString()); dicField4Cust.Add("member_period_validity", dtp_validity_time.Value.Ticks.ToString()); dicField4Cust.Add("update_by", GlobalStaticObj.CurrUserCom_Code); dicField4Cust.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); Boolean result, result4Cust; try { result = DBHelper.Submit_AddOrEdit("保存会员信息", "tb_CustomerSer_Member", "vip_id", VipId, dicFileds); result4Cust = DBHelper.Submit_AddOrEdit("更新客户档案", "tb_customer", "cust_id", CustId, dicField4Cust); } catch (Exception ex) { result = false; result4Cust = false; } MessageBoxEx.Show(result && result4Cust ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result && result4Cust) { UCMemberManager.BindPageData(); deleteMenuByTag(Tag.ToString(), UCMemberManager.Name); } }; #endregion #endregion }
//初始化 private void Init() { dgvQData.MultiSelect = false; //不允许多选操作 SetUCBaseFuncationVisible(); #region 初始化时间控件值 dtpCBSTime.Value = DateTime.Now.AddMonths(-1); dtpCBETime.Value = DateTime.Now.AddDays(+1); #endregion #region 初始化下拉框数据绑定 CommonCtrl.BindComboBoxByDictionarr(cboCBType, "sys_callback_type", true); //绑定回访类型 CommonCtrl.BindComboBoxByDictionarr(cboCBMode, "sys_callback_mode", true); //绑定回访方式 #endregion #region 注册功能按钮事件 #region 清除查询条件 btnClear.Click += delegate { txtCBTitle.Caption = String.Empty; cboCBType.SelectedValue = String.Empty; cboCBMode.SelectedValue = String.Empty; dtpCBSTime.Value = DateTime.Now.AddMonths(-1); dtpCBETime.Value = DateTime.Now.AddDays(1); txtCustomerName.Text = String.Empty; txtCustomerName.Tag = String.Empty; txtCBPerson.Text = String.Empty; }; #endregion #region 查询 btnQuery.Click += delegate { BindPageData(); }; #endregion #region 择客户信息 txtCustomerName.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { txtCustomerName.Text = frmCustomer.strCustomerName; txtCustomerName.Tag = frmCustomer.strCustomerId; } }; #endregion #region 择回访人 txtCBPerson.ChooserClick += delegate { var frmContacts = new frmContacts(); var result = frmContacts.ShowDialog(); if (result == DialogResult.OK) { txtCBPerson.Text = frmContacts.contName; txtCBPerson.Tag = frmContacts.contID; } }; #endregion #region 数据翻页 pageQ.PageIndexChanged += delegate { BindPageData(); }; #endregion #region 数据表数据选择 dgvQData.CellDoubleClick += delegate(object sender, DataGridViewCellEventArgs args) { if (args.ColumnIndex <= 0) { return; } var uc = new UCCallBackAddOrEdit { OpType = WindowStatus.View, UCCallBackManager = this }; var selectedData = dgvQData.SelectedRows[0]; uc.CallBackId = selectedData.Cells["drtxt_Callback_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询回访信息", "tb_CustomerSer_Callback", "*", "Callback_id = '" + uc.CallBackId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["Callback_corp"].ToString(); uc.ContId = callbackInfo.DefaultView[0]["Callback_by"].ToString(); uc.HandleId = callbackInfo.DefaultView[0]["handle_name"].ToString(); } uc.addUserControl(uc, "客户回访-预览", "UCCallBackView", Tag.ToString(), Name); }; #endregion #region 数据表格数据格式化 dgvQData.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args) { UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "Callback_by", "tb_contacts", "cont_id", "cont_name"); UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "handle_name", "sys_user", "user_id", "user_name"); UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "Callback_corp", "tb_customer", "cust_id", "cust_name"); UIAssistants.DgvCellDataConvert2Datetime(dgvQData, args, "Callback_time"); UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "Callback_type"); //访问类型 UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "Callback_mode"); //访问形式 UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "status"); //状态 }; #endregion #region 新增数据 AddEvent += delegate { var uc = new UCCallBackAddOrEdit(); uc.UCCallBackManager = this; uc.OpType = WindowStatus.Add; uc.addUserControl(uc, "客户回访-新增", "UCCallBackAdd", Tag.ToString(), Name); }; #endregion #region 编辑数据 EditEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCCallBackAddOrEdit(); uc.OpType = WindowStatus.Edit; uc.UCCallBackManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.CallBackId = selectedData.Cells["drtxt_Callback_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询回访信息", "tb_CustomerSer_Callback", "*", "Callback_id = '" + uc.CallBackId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["Callback_corp"].ToString(); uc.ContId = callbackInfo.DefaultView[0]["Callback_by"].ToString(); uc.HandleId = callbackInfo.DefaultView[0]["handle_name"].ToString(); } uc.addUserControl(uc, "客户回访-编辑", "UCCallBackEdit", Tag.ToString(), Name); } }; #endregion #region 除数据 DeleteEvent += delegate { try { if (dgvQData.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var listField = (from DataGridViewRow selectedRow in dgvQData.SelectedRows select selectedRow.Cells["drtxt_Callback_id"].Value.ToString()).ToList(); var result = MessageBoxEx.Show("此操作将永久删除选定信息。\n若要继续,请单击“确定”。", "您确认要删除此条信息吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { var flag = DBHelper.BatchDeleteDataByWhere("删除客户回访信息", "tb_CustomerSer_Callback", String.Format("Callback_id = '{0}'", listField[0])); if (flag) { BindPageData(); MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } else { MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }; #endregion #region 启用/禁用 StatusEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var dataView = GetSelectedRowData(); var listField = GetCheckRows(); if (listField.Count >= 1) { if (MessageBoxEx.Show("确认要" + btnStatus.Caption + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } var flag = false; foreach (DataRowView view in dataView) { var status = CommonCtrl.IsNullToString(view[drtxt_status.DataPropertyName]); flag = DBHelper.Submit_AddOrEdit("启用/停用客户回访记录", "tb_CustomerSer_Callback", "Callback_id", CommonCtrl.IsNullToString(view[drtxt_Callback_id.DataPropertyName]), new Dictionary <string, string> { { "status", status == DbDic2Enum.SYS_DATA_STATUS_QI ? DbDic2Enum.SYS_DATA_STATUS_JIN : DbDic2Enum.SYS_DATA_STATUS_QI }, { "update_by", GlobalStaticObj.UserID }, { "update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj.CurrentDateTime).ToString() } }); } MessageBoxEx.Show(btnStatus.Caption + (flag ? "成功!" : "失败!"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } } }; #endregion #region 根据选择的数据判断功能按钮的显示状态 dgvQData.CellMouseUp += delegate { var dataView = GetSelectedRowData(); var listField = GetCheckRows(); btnStatus.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; if (dataView == null || listField.Count == 0) { } else { #region 编辑 if (listField.Count == 1) { btnEdit.Enabled = true; btnDelete.Enabled = true; } #endregion #region 启用/禁用 var qy = 0; var jy = 0; foreach (DataRowView rowView in dataView) //启用/禁用 { if (rowView["status"].ToString() == DbDic2Enum.SYS_DATA_STATUS_QI) { qy++; } else if (rowView["status"].ToString() == DbDic2Enum.SYS_DATA_STATUS_JIN) { jy++; } } if (qy == 0 && jy != 0) { btnStatus.Enabled = true; btnStatus.Caption = "启用"; btnStatus.Width = 60; } else if (qy != 0 && jy == 0) { btnStatus.Enabled = true; btnStatus.Caption = "禁用"; btnStatus.Width = 60; } else { btnStatus.Enabled = false; btnStatus.Caption = "启用/禁用"; btnStatus.Width = 90; } #endregion } }; #endregion #endregion BindPageData(); }
//初始化 private void Init() { dgvQData.MultiSelect = false; //不允许多选操作 SetUCBaseFuncationVisible(); #region 初始化时间控件值 dtpCBSTime.Value = DateTime.Now.AddMonths(-1); dtpCBETime.Value = DateTime.Now.AddDays(+1); #endregion #region 初始化下拉框数据绑定 CommonCtrl.BindComboBoxByDictionarr(cboCBType, "sys_callback_type", true); //绑定反馈类型 CommonCtrl.BindComboBoxByDictionarr(cboCBMode, "sys_callback_mode", true); //绑定反馈方式 #endregion #region 注册功能按钮事件 #region 清除查询条件 btnClear.Click += delegate { txtCBTitle.Caption = String.Empty; cboCBType.SelectedValue = String.Empty; cboCBMode.SelectedValue = String.Empty; dtpCBSTime.Value = DateTime.Now.AddMonths(-1); dtpCBETime.Value = DateTime.Now; txtCustomerName.Text = String.Empty; txtCBPerson.Text = String.Empty; }; #endregion #region 查询 btnQuery.Click += delegate { BindPageData(); }; #endregion #region 择客户信息 txtCustomerName.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { txtCustomerName.Text = frmCustomer.strCustomerName; txtCustomerName.Tag = frmCustomer.strCustomerId; } }; #endregion #region 择反馈人 txtCBPerson.ChooserClick += delegate { var frmContacts = new frmContacts(); var result = frmContacts.ShowDialog(); if (result == DialogResult.OK) { txtCBPerson.Text = frmContacts.contName; txtCBPerson.Tag = frmContacts.contID; } }; #endregion #region 数据翻页 pageQ.PageIndexChanged += delegate { BindPageData(); }; #endregion #region 数据表数据选择 dgvQData.CellDoubleClick += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCFeedbackAddOrEdit(); uc.OpType = WindowStatus.View; uc.UCFeedbakcManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.FeedbackId = selectedData.Cells["drtxt_Feedback_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询反馈信息", "tb_CustomerSer_Feedback", "*", "Feedback_id = '" + uc.FeedbackId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["corp_id"].ToString(); uc.ContId = callbackInfo.DefaultView[0]["Feedback_by"].ToString(); uc.HandleId = callbackInfo.DefaultView[0]["handle_name"].ToString(); } uc.addUserControl(uc, "信息反馈-详细", "UCFeedbackView", Tag.ToString(), Name); } }; #endregion #region 数据表格数据格式化 dgvQData.CellFormatting += delegate(object sender, DataGridViewCellFormattingEventArgs args) { UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "Feedback_by", "tb_contacts", "cont_id", "cont_name"); UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "handle_name", "sys_user", "user_id", "user_name"); UIAssistants.DgvCellDataConvert2Table(dgvQData, args, "corp_id", "tb_customer", "cust_id", "cust_name"); UIAssistants.DgvCellDataConvert2Datetime(dgvQData, args, "Feedback_time"); UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "Feedback_type"); //反馈类型 UIAssistants.DgvCellDataConvert2DicData(dgvQData, args, "Feedback_mode"); //反馈形式 }; #endregion #region 新增数据 AddEvent += delegate { var uc = new UCFeedbackAddOrEdit(); uc.UCFeedbakcManager = this; uc.OpType = WindowStatus.Add; uc.addUserControl(uc, "信息反馈-新增", "UCFeedbackAdd", Tag.ToString(), Name); }; #endregion #region 编辑数据 EditEvent += delegate { if (dgvQData.SelectedRows.Count > 0) { var uc = new UCFeedbackAddOrEdit(); uc.OpType = WindowStatus.Edit; uc.UCFeedbakcManager = this; var selectedData = dgvQData.SelectedRows[0]; uc.FeedbackId = selectedData.Cells["drtxt_Feedback_id"].Value.ToString(); var callbackInfo = DBHelper.GetTable("查询反馈信息", "tb_CustomerSer_Feedback", "*", "Feedback_id = '" + uc.FeedbackId + "'", "", ""); if (callbackInfo != null && callbackInfo.DefaultView.Count != 0) { uc.CustId = callbackInfo.DefaultView[0]["corp_id"].ToString(); uc.ContId = callbackInfo.DefaultView[0]["Feedback_by"].ToString(); uc.HandleId = callbackInfo.DefaultView[0]["handle_name"].ToString(); } uc.addUserControl(uc, "信息反馈-编辑", "UCFeedbackEdit", Tag.ToString(), Name); } BindPageData("1=1"); }; #endregion #region 除数据 DeleteEvent += delegate { try { if (dgvQData.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var listField = (from DataGridViewRow selectedRow in dgvQData.SelectedRows select selectedRow.Cells["drtxt_Feedback_id"].Value.ToString()).ToList(); var result = MessageBoxEx.Show("此操作将永久删除选定信息。\n若要继续,请单击“确定”。", "您确认要删除此条信息吗?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { var flag = DBHelper.DeleteDataByID("删除反馈信息", "tb_CustomerSer_Feedback", "Feedback_id", listField[0]); if (flag) { BindPageData(); MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } else { MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } BindPageData("1=1"); }; #endregion #region 根据选择的数据判断功能按钮的显示状态 dgvQData.CellMouseUp += delegate { var dataView = GetSelectedRowData(); var listField = GetCheckRows(); btnStatus.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; if (dataView == null || listField.Count == 0) { } else { #region 编辑 if (listField.Count == 1) { btnEdit.Enabled = true; btnDelete.Enabled = true; } #endregion } }; #endregion #endregion BindPageData(); }
//初始化 private void Init() { #region 设置功能按钮可见性 UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms>() { btnSave, btnCancel, btnSet, btnView, btnPrint }); #endregion #region 初始化下拉框数据绑定 CommonCtrl.CmbBindDict(cbo_cb_Callback_type, "sys_callback_type", false); //绑定回访类型 CommonCtrl.CmbBindDict(cbo_cb_Callback_mode, "sys_callback_mode", false); //绑定回访方式 CommonCtrl.CmbBindDict(cbo_member_class, "sys_member_grade", false); //绑定会员等级 CommonFuncCall.BindProviceComBox(cbo_province, "请选择"); //绑定省份 CommonFuncCall.BindCityComBox(cbo_city, "", "请选择"); //绑定城市 CommonFuncCall.BindCountryComBox(cbo_county, "", "请选择"); //绑定县/区 cbo_province.SelectedIndexChanged += ddlprovince_SelectedIndexChanged; cbo_city.SelectedIndexChanged += ddlcity_SelectedIndexChanged; CommonCtrl.CmbBindDict(cbo_cust_type, "sys_customer_category", false); //客户类别 #endregion lbl_cb_create_by.Text = GlobalStaticObj.CurrUserCom_Name; lbl_cb_create_by.Tag = GlobalStaticObj.UserID; if (windowStatus == WindowStatus.Edit || windowStatus == WindowStatus.View) { SetCustInfo(); SetContInfo(); SetCallbackInfo(); } if (windowStatus == WindowStatus.View) { palQTop.Enabled = false; } #region 注册功能按钮事件 #region 择客户信息 txt_cust_code.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { CustId = frmCustomer.strCustomerId; txt_cust_code.Tag = CustId; txt_cust_code.Text = frmCustomer.strCustomerNo; } SetCustInfo(); }; #endregion #region 择被回访人 txt_cb_Callback_by.ChooserClick += delegate { var frmContacts = new frmContacts(); var result = frmContacts.ShowDialog(); if (result == DialogResult.OK) { ContId = frmContacts.contID; txt_cb_Callback_by.Tag = ContId; txt_cb_Callback_by.Text = frmContacts.contName; txt_cb_Callback_by_duty.Caption = frmContacts.contDuty; txt_cb_Callback_by_phone.Caption = frmContacts.contPhone; } }; #endregion #region 择经办人 txt_handle_name.ChooserClick += delegate { var chooser = new frmUsers(); var result = chooser.ShowDialog(); if (result == DialogResult.OK) { txt_handle_name.Text = chooser.User_Name; txt_handle_name.Tag = chooser.User_ID; txt_cb_handle_org.Caption = chooser.OrgName; } }; #endregion CancelEvent += (sender, args) => deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); #region 保存数据 SaveEvent += delegate { var check = CheckValue(); if (!check) { return; } var dicFileds = new Dictionary <String, String>(); if (windowStatus == WindowStatus.Add) { dicFileds.Add("create_by", GlobalStaticObj.UserID); //创建人 dicFileds.Add("create_time", DBHelper.GetCurrentTime().Ticks.ToString()); //创建时间 dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 dicFileds.Add("Callback_id", Guid.NewGuid().ToString()); //客户ID dicFileds.Add("status", "58b325d2-0792-4847-8e4a-22b3f25628f3"); //数据状态 } else if (windowStatus == WindowStatus.Edit) { dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 } dicFileds.Add("Callback_corp", txt_cust_code.Tag.ToString()); //客户ID dicFileds.Add("Callback_time", DBHelper.GetCurrentTime().Ticks.ToString()); //回访时间 dicFileds.Add("Callback_type", cbo_cb_Callback_type.SelectedValue.ToString()); //回访类型 dicFileds.Add("Callback_mode", cbo_cb_Callback_mode.SelectedValue.ToString()); //回访方式 dicFileds.Add("title", txt_cb_title.Caption); //回访标题 dicFileds.Add("record", rtx_cb_record.Text); //回访内容 dicFileds.Add("Callback_by", txt_cb_Callback_by.Tag.ToString()); //被回访人员名称 dicFileds.Add("Callback_by_org", txt_cb_Callback_by_org.Caption); //被回访人员部门名称 dicFileds.Add("Callback_by_phone", txt_cb_Callback_by_phone.Caption); //被回访人电话 dicFileds.Add("Callback_by_duty", txt_cb_Callback_by_duty.Caption); //被回访人职务 dicFileds.Add("handle_name", txt_handle_name.Tag.ToString()); //经办人 dicFileds.Add("handle_org", txt_cb_handle_org.Caption); //经办人部门名称 var result = false; try { result = DBHelper.Submit_AddOrEdit("保存客户回访", "tb_CustomerSer_Callback", "Callback_id", CallBackId, dicFileds); } catch (Exception ex) { result = false; } MessageBoxEx.Show(result ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result) { UCCallBackManager.BindPageData(); _autoClose = false; deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); } }; #endregion #endregion }
//初始化 private void Init() { #region 设置功能按钮可见性 UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms>() { btnSave, btnCancel, btnSet, btnView, btnPrint }); #endregion #region 初始化下拉框数据绑定 CommonCtrl.CmbBindDict(cbo_cb_Callback_type, "sys_callback_type", false); //绑定回访类型 CommonCtrl.CmbBindDict(cbo_cb_Callback_mode, "sys_callback_mode", false); //绑定回访方式 CommonCtrl.CmbBindDict(cbo_member_class, "sys_member_grade", false); //绑定会员等级 CommonFuncCall.BindProviceComBox(cbo_province, "请选择"); //绑定省份 CommonFuncCall.BindCityComBox(cbo_city, "", "请选择"); //绑定城市 CommonFuncCall.BindCountryComBox(cbo_county, "", "请选择"); //绑定县/区 cbo_province.SelectedIndexChanged += ddlprovince_SelectedIndexChanged; cbo_city.SelectedIndexChanged += ddlcity_SelectedIndexChanged; CommonCtrl.CmbBindDict(cbo_cust_type, "sys_customer_category", false); //客户类别 #endregion lbl_cb_create_by.Text = GlobalStaticObj.CurrUserCom_Name; lbl_cb_create_by.Tag = GlobalStaticObj.UserID; if (windowStatus == WindowStatus.Edit || windowStatus == WindowStatus.View) { SetCustInfo(); SetContInfo(); SetCallbackInfo(); } if (windowStatus == WindowStatus.View) { palQTop.Enabled = false; } #region 注册功能按钮事件 #region 择客户信息 txt_cust_code.ChooserClick += delegate { var frmCustomer = new frmCustomerInfo(); var result = frmCustomer.ShowDialog(); if (result == DialogResult.OK) { CustId = frmCustomer.strCustomerId; txt_cust_code.Tag = CustId; txt_cust_code.Text = frmCustomer.strCustomerNo; SetCustInfo(); } }; dataGridViewEx1.CellContentClick += delegate(object sender, DataGridViewCellEventArgs args) { if (args.ColumnIndex < 0 || args.RowIndex < 0) { return; } if (dataGridViewEx1.Columns[args.ColumnIndex] == drtxt_maintain_no) { var ytServiceNo = CommonCtrl.IsNullToString(dataGridViewEx1.Rows[args.RowIndex].Cells[drtxt_maintain_id.Name].Value); if (String.IsNullOrEmpty(CommonCtrl.IsNullToString(ytServiceNo))) { return; } var uc = new RepairQueryView(ytServiceNo); uc.addUserControl(uc, "维修单-详细信息", "RepairQueryView" + ytServiceNo, Tag.ToString(), Name); } }; #endregion #region 择被回访人 txt_cb_Callback_by.ChooserClick += delegate { var frmContacts = new frmContacts(); var result = frmContacts.ShowDialog(); if (result == DialogResult.OK) { ContId = frmContacts.contID; txt_cb_Callback_by.Tag = ContId; txt_cb_Callback_by.Text = frmContacts.contName; txt_cb_Callback_by_duty.Caption = frmContacts.contDuty; txt_cb_Callback_by_phone.Caption = frmContacts.contPhone; } }; #endregion #region 择经办人 txt_handle_name.ChooserClick += delegate { var chooser = new frmUsers(); var result = chooser.ShowDialog(); if (result == DialogResult.OK) { txt_handle_name.Text = chooser.User_Name; txt_handle_name.Tag = chooser.User_ID; txt_cb_handle_org.Caption = chooser.OrgName; } }; #endregion //CancelEvent += (sender, args) => deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); CancelEvent += new ClickHandler(UCCallBackAddOrEdit_CancelEvent); #region 保存数据 SaveEvent += delegate { var check = CheckValue(); if (!check) { return; } var dicFileds = new Dictionary <String, String>(); if (windowStatus == WindowStatus.Add) { dicFileds.Add("create_by", GlobalStaticObj.UserID); //创建人 dicFileds.Add("create_time", DBHelper.GetCurrentTime().Ticks.ToString()); //创建时间 dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 dicFileds.Add("Callback_id", Guid.NewGuid().ToString()); //客户ID dicFileds.Add("status", "58b325d2-0792-4847-8e4a-22b3f25628f3"); //数据状态 } else if (windowStatus == WindowStatus.Edit) { DBHelper.BatchDeleteDataByWhere("删除客户与维修单关系", "tr_maintain_customer_callback", String.Format("callback_id = '{0}'", CallBackId)); dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 } dicFileds.Add("Callback_corp", txt_cust_code.Tag.ToString()); //客户ID dicFileds.Add("Callback_time", DBHelper.GetCurrentTime().Ticks.ToString()); //回访时间 dicFileds.Add("Callback_type", cbo_cb_Callback_type.SelectedValue.ToString()); //回访类型 dicFileds.Add("Callback_mode", cbo_cb_Callback_mode.SelectedValue.ToString()); //回访方式 dicFileds.Add("title", txt_cb_title.Caption); //回访标题 dicFileds.Add("record", rtx_cb_record.Text); //回访内容 dicFileds.Add("Callback_by", txt_cb_Callback_by.Tag.ToString()); //被回访人员名称 dicFileds.Add("Callback_by_org", txt_cb_Callback_by_org.Caption); //被回访人员部门名称 dicFileds.Add("Callback_by_phone", txt_cb_Callback_by_phone.Caption); //被回访人电话 dicFileds.Add("Callback_by_duty", txt_cb_Callback_by_duty.Caption); //被回访人职务 dicFileds.Add("handle_name", txt_handle_name.Tag.ToString()); //经办人 dicFileds.Add("handle_org", txt_cb_handle_org.Caption); //经办人部门名称 var result = false; try { result = DBHelper.Submit_AddOrEdit("保存客户回访", "tb_CustomerSer_Callback", "Callback_id", CallBackId, dicFileds); if (result) { const string sqlStr = "INSERT INTO tr_maintain_customer_callback(id,maintain_id,customer_id ,callback_id) VALUES(@id,@maintain_id,@customer_id,@callback_id)"; var list = GetCheckRows(); var sysSqlStrList = list.Select(str => new SysSQLString { cmdType = CommandType.Text, sqlString = sqlStr, Param = new Dictionary <string, string> { { "@id", Guid.NewGuid().ToString() }, { "@maintain_id", str }, { "@customer_id", txt_cust_code.Tag.ToString() }, { "@callback_id", String.IsNullOrEmpty(CallBackId) ? dicFileds["Callback_id"] : CallBackId } } }).ToList(); DBHelper.BatchExeSQLStringMultiByTrans("添加客户与维修单关系", sysSqlStrList); } } catch (Exception ex) { result = false; } MessageBoxEx.Show(result ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result) { UCCallBackManager.BindPageData(); _autoClose = false; deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name); } }; #endregion #endregion }