public frmBtype() { InitializeComponent(); UIAssistants.SetButtonStyle4QueryAndClear(btnSearch, btnClear); //设置查询按钮和清除按钮样式 UIAssistants.SetButtonStyle4QueryAndClear(btnSearchCust, btnClearCust); CommonCtrl.BindComboBoxByDictionarr(cobCustType, "sys_credit_rating", true); }
private void UCVehicleManage_Load(object sender, EventArgs e) { #region 基础数据加载 CommonCtrl.BindComboBoxByDictionarr(cobCarBrand, "sys_vehicle_brand", true); //绑定车型品牌 cobDataSources.DataSource = DataSources.EnumToList(typeof(DataSources.EnumDataSources), true); //数据来源 cobDataSources.ValueMember = "Value"; cobDataSources.DisplayMember = "Text"; cobStatus.DataSource = DataSources.EnumToList(typeof(DataSources.EnumStatus), true);//绑定状态 启用 停用 cobStatus.ValueMember = "Value"; cobStatus.DisplayMember = "Text"; #endregion dtpCSTime.Value = DateTime.Now.AddMonths(-1); dtpCETime.Value = DateTime.Now; dgvData.ReadOnly = false; foreach (DataGridViewColumn dgvc in dgvData.Columns) { if (dgvc == colCheck) { continue; } dgvc.ReadOnly = true; } this.InitEvent(); this.page.PageIndexChanged += new ServiceStationClient.ComponentUI.WinFormPager.EventHandler(this.page_PageIndexChanged); SetTopbuttonShow(); BindPageData(); }
private void InitQueryControlDataSource() //初始化查询控件数据项 { dtp_settlement_cycle_start.Value = DBHelper.GetCurrentTime().AddMonths(-1); dtp_settlement_cycle_end.Value = DBHelper.GetCurrentTime().AddDays(1); CommonCtrl.BindComboBoxByDictionarr(cbo_yt_info_status, "settlement_repair_status_yt", true); //宇通结算状态(宇通同步数据) CommonCtrl.BindComboBoxByDictionarr(cbo_station_info_status, "sys_station_settlement_status", true); //绑定服务站计算单状态 }
BusinessPrint businessPrint;//业务打印功能 #endregion #region 初始化窗体 public UCRepairBalanceManager() { InitializeComponent(); CommonCtrl.BindComboBoxByDictionarr(cobPayType, "sys_repair_pay_methods", true); //绑定维修付费方式 CommonCtrl.BindComboBoxByDictionarr(cobRepType, "sys_repair_category", true); //绑定维修类别 BindOrderStatus(); UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式 base.AddEvent += new ClickHandler(UCRepairBalanceManager_AddEvent); base.CopyEvent += new ClickHandler(UCRepairBalanceManager_CopyEvent); base.EditEvent += new ClickHandler(UCRepairBalanceManager_EditEvent); base.DeleteEvent += new ClickHandler(UCRepairBalanceManager_DeleteEvent); base.ViewEvent += new ClickHandler(UCRepairBalanceManager_ViewEvent); base.VerifyEvent += new ClickHandler(UCRepairBalanceManager_VerifyEvent); base.BalanceEvent += new ClickHandler(UCRepairBalanceManager_BalanceEvent); base.PrintEvent += new ClickHandler(UCRepairBalanceManager_PrintEvent); base.SetEvent += new ClickHandler(UCRepairBalanceManager_SetEvent); SetQuick(); base.SetContentMenuScrip(dgvRData); #region 预览、打印设置 string printObject = "tb_maintain_settlement_info"; string printTitle = "维修结算单"; List <string> listNotPrint = new List <string>(); listNotPrint.Add(maintain_id.Name); //listNotPrint.Add(v_brand.Name); PaperSize paperSize = new PaperSize(); paperSize.Width = 297; paperSize.Height = 210; businessPrint = new BusinessPrint(dgvRData, printObject, printTitle, paperSize, listNotPrint); #endregion }
/// <summary> /// 初始化车型、车辆品牌、颜色、维修付费方式、维修类别信息 /// </summary> private void initializeData() { CommonCtrl.BindComboBoxByDictionarr(cobCarBrand, "sys_vehicle_brand", true); //绑定车型品牌 CommonCtrl.BindComboBoxByDictionarr(cobColor, "sys_vehicle_color", true); //绑定颜色 CommonCtrl.BindComboBoxByDictionarr(cobPayType, "sys_repair_pay_methods", true); //绑定维修付费方式 CommonCtrl.BindComboBoxByDictionarr(cobRepType, "sys_repair_category", true); //绑定维修类别 }
//绑定查询条件 private void BindSearch() { BindIsDefault(); BindBelongTo(); BindSex(); //CommonCtrl.BindComboBoxByDictionarr(cboSex, "sys_sex", true);//绑定性别 CommonCtrl.BindComboBoxByDictionarr(cboContPost, "sys_position", true);//绑定职务 }
private void InitQueryControlDataSource() //初始化查询控件数据项 { DataSources.BindComBoxDataEnum(cbo_is_member, typeof(DataSources.EnumYesNo), true); //是否会员 CommonFuncCall.BindProviceComBox(cboprovince, "省"); //省份 CommonCtrl.BindComboBoxByDictionarr(cbo_cust_type, "sys_customer_category", true); //客户类别 DataSources.BindComBoxDataEnum(cbo_status, typeof(DataSources.EnumStatus), true); //数据状态 DataSources.BindComBoxDataEnum(cbo_data_source, typeof(DataSources.EnumDataSources), true); //数据来源 }
public frmContacts() { InitializeComponent(); CommonCtrl.BindComboBoxByDictionarr(cbo_data_source, "sys_data_source", true); BinddgvContacts(); }
public frmCustomerInfo() { InitializeComponent(); UIAssistants.SetButtonStyle4QueryAndClear(btnSearch, btnClear); //设置查询按钮和清除按钮样式 CommonCtrl.BindComboBoxByDictionarr(cobCustType, "sys_credit_rating", true); BindTvCustom(); BindPageData(); }
public frmSupplier() { InitializeComponent(); //绑定企业性质类型 CommonFuncCall.BindComBoxDataSource(ddlCompanyNature, "sys_enterprise_property", "全部"); //绑定企业性质类型 CommonCtrl.BindComboBoxByDictionarr(unit_properties, "sys_enterprise_property"); CommonCtrl.BindComboBoxByDictionarr(sup_type, "sys_supplier_category"); CreatPropertiesTree(); ddlCompanyNature.SelectedIndex = 0; }
List <string> listIDs = new List <string>();//已选择ID #endregion #region 初始化窗体 public UCDispatchManager() { InitializeComponent(); CommonCtrl.BindComboBoxByDictionarr(cobPayType, "sys_repair_pay_methods", true);//绑定维修付费方式 BindOrderStatus(); SetTopbuttonShow(); UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式 base.ViewEvent += new ClickHandler(UCDispatchManager_ViewEvent); base.Delete += new ClickHandler(UCDispatchManager_Delete); base.QCEvent += new ClickHandler(UCDispatchManager_QCEvent); base.BalanceEvent += new ClickHandler(UCDispatchManager_BalanceEvent); }
//绑定查询上的控件 private void BindSearch() { //CommonCtrl.BindComboBoxByDictionarr(cboDataSource, "sys_data_source", true);//绑定数据源 cboDataSource.DataSource = DataSources.EnumToList(typeof(SYSModel.DataSources.EnumDataSources), true); cboDataSource.ValueMember = "Value"; cboDataSource.DisplayMember = "Text"; cboStatus.DataSource = DataSources.EnumToList(typeof(DataSources.EnumStatus), true);//绑定状态 cboStatus.ValueMember = "Value"; cboStatus.DisplayMember = "Text"; CommonCtrl.BindComboBoxByDictionarr(cboBrand, "sys_vehicle_brand", true); //绑定车型品牌 CommonCtrl.BindComboBoxByDictionarr(cboType, "sys_vehicle_model_category", true); //绑定车型类型 //CommonCtrl.BindComboBoxByDictionarr(cboStatus, "sys_data_status", true);//绑定状态 }
public UCVehicleAddOrEdit() { InitializeComponent(); dtpSTime.Value = DateTime.Now; CommonCtrl.BindComboBoxByDictionarr(cobCarBrand, "sys_vehicle_brand", true); //绑定车型品牌 CommonCtrl.BindComboBoxByDictionarr(cobRating, "sys_vehicle_grade", true); //绑定车辆等级 CommonCtrl.BindComboBoxByDictionarr(cobColor, "sys_vehicle_color", true); //绑定车辆颜色 CommonCtrl.BindComboBoxByDictionarr(cobFactory, "sys_vehicle_factory", true); //绑定车辆生产厂家 SetTexDecimal(); SetDgvAnchor(); SetTopbuttonShow(); base.SaveEvent += new ClickHandler(UCVehicleAddOrEdit_SaveEvent); base.CancelEvent += new ClickHandler(UCVehicleAddOrEdit_CancelEvent); }
//绑定查询条件 private void BindSearch() { BindIsDefault(); BindBelongTo(); BindSex(); //CommonCtrl.BindComboBoxByDictionarr(cboSex, "sys_sex", true);//绑定性别 CommonCtrl.BindComboBoxByDictionarr(cboContPost, "sys_position", true); //绑定职务 cboDataSources.DataSource = DataSources.EnumToList(typeof(DataSources.EnumDataSources), true); //数据来源 cboDataSources.ValueMember = "Value"; cboDataSources.DisplayMember = "Text"; cboStatus.DataSource = DataSources.EnumToList(typeof(DataSources.EnumStatus), true);//状态 cboStatus.ValueMember = "Value"; cboStatus.DisplayMember = "Text"; }
List <string> listIDs = new List <string>(); //已选择ID #endregion public UCRepairRescueManager() { InitializeComponent(); BindOrderStatus(); SetTopbuttonShow(); CommonCtrl.BindComboBoxByDictionarr(cobRescueType, "sys_rescue_type", true); //救援类型 UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式 base.AddEvent += new ClickHandler(UCRepairRescueManager_AddEvent); base.CopyEvent += new ClickHandler(UCRepairRescueManager_CopyEvent); base.EditEvent += new ClickHandler(UCRepairRescueManager_EditEvent); base.DeleteEvent += new ClickHandler(UCRepairRescueManager_DeleteEvent); base.ViewEvent += new ClickHandler(UCRepairRescueManager_ViewEvent); base.VerifyEvent += new ClickHandler(UCRepairRescueManager_VerifyEvent); base.BalanceEvent += new ClickHandler(UCRepairRescueManager_BalanceEvent); }
/// <summary> /// 初始化查询控件数据项 /// </summary> private void InitQueryControlDataSource() { DataSources.BindComBoxDataEnum(cbo_combobox, typeof(DataSources.EnumYesNo), true); //枚举类型绑定 CommonCtrl.BindComboBoxByDictionarr(cbo_combobox, "settlement_repair_status_yt", true); //数据字典绑定 txt_chooser.ChooserClick += delegate //选择器 { var custChooser = new FormChooser(); var result = custChooser.ShowDialog(); if (result != DialogResult.OK) { return; } //对查询控件进行赋值 }; }
List <string> listIDs = new List <string>(); //已选择ID #endregion #region 初始化 public UCReceiveManager() { InitializeComponent(); CommonCtrl.BindComboBoxByDictionarr(cobPayType, "sys_repair_pay_methods", true);//绑定维修付费方式 BindOrderStatus(); SetTopbuttonShow(); UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式 base.AddEvent += new ClickHandler(UCReceiveManager_AddEvent); base.CopyEvent += new ClickHandler(UCReceiveManager_CopyEvent); base.EditEvent += new ClickHandler(UCReceiveManager_EditEvent); base.DeleteEvent += new ClickHandler(UCReceiveManager_DeleteEvent); base.ViewEvent += new ClickHandler(UCReceiveManager_ViewEvent); base.SubmitEvent += new ClickHandler(UCReceiveManager_SubmitEvent); base.VerifyEvent += new ClickHandler(UCReceiveManager_VerifyEvent); }
private void UCCustomerAddOrEdit_Load(object sender, EventArgs e) //取数据赋值 { CommonFuncCall.BindProviceComBox(cboprovince, "省"); //省份 CommonCtrl.BindComboBoxByDictionarr(cbocust_type, "sys_customer_category", true); //客户类别 码表 CommonCtrl.BindComboBoxByDictionarr(cboenterprise_nature, "sys_enterprise_property", true); //企业性质 码表 CommonCtrl.BindComboBoxByDictionarr(cboprice_type, "sys_customer_price_type", true); //价格类型 码表 CommonCtrl.BindComboBoxByDictionarr(cboopen_bank, "sys_deposit_bank", true); //开户银行 码表 CommonCtrl.BindComboBoxByDictionarr(cbomember_class, "sys_member_grade", true); //会员等级 码表 CommonCtrl.BindComboBoxByDictionarr(cbocredit_rating, "sys_credit_rating", true); //信用等级 码表 InitDataGridCellFormatting(); ucAttr.TableName = "tb_customer"; ucAttr.TableNameKeyValue = "cust_id"; BindControls(); }
public UCRepairBalanceManager() { InitializeComponent(); CommonCtrl.BindComboBoxByDictionarr(cobPayType, "sys_repair_pay_methods", true); //绑定维修付费方式 CommonCtrl.BindComboBoxByDictionarr(cobRepType, "sys_repair_category", true); //绑定维修类别 BindOrderStatus(); UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式 base.AddEvent += new ClickHandler(UCRepairBalanceManager_AddEvent); base.CopyEvent += new ClickHandler(UCRepairBalanceManager_CopyEvent); base.EditEvent += new ClickHandler(UCRepairBalanceManager_EditEvent); base.DeleteEvent += new ClickHandler(UCRepairBalanceManager_DeleteEvent); base.ViewEvent += new ClickHandler(UCRepairBalanceManager_ViewEvent); base.VerifyEvent += new ClickHandler(UCRepairBalanceManager_VerifyEvent); base.BalanceEvent += new ClickHandler(UCRepairBalanceManager_BalanceEvent); SetQuick(); base.SetContentMenuScrip(dgvRData); }
//加载 private void UCContactsAddOrEdit_Load(object sender, EventArgs e) { SetBtnStatus(status); var btnCols = new ObservableCollection <ButtonEx_sms>() { btnSave, btnImport, btnExport, btnSet, btnView, btnPrint, btnCancel }; UIAssistants.SetUCBaseFuncationVisible(this, btnCols); CommonCtrl.BindComboBoxByDictionarr(cboNation, "nation_yt", false); //绑定民族 CommonCtrl.BindComboBoxByDictionarr(cboContPost, "sys_position", false); //绑定职务 cboNation.SelectedIndex = 27; //如果是编辑或者复制,则先绑定数据 if ((status == WindowStatus.Edit || status == WindowStatus.Copy) && contID.Length > 0) { BindData(); } }
private void UCVehicleManage_Load(object sender, EventArgs e) { #region 基础数据加载 CommonCtrl.BindComboBoxByDictionarr(cobCarBrand, "sys_vehicle_brand", true); //绑定车型品牌 cobDataSources.DataSource = DataSources.EnumToList(typeof(DataSources.EnumDataSources), true); //数据来源 cobDataSources.ValueMember = "Value"; cobDataSources.DisplayMember = "Text"; cobStatus.DataSource = DataSources.EnumToList(typeof(DataSources.EnumStatus), true);//绑定状态 启用 停用 cobStatus.ValueMember = "Value"; cobStatus.DisplayMember = "Text"; #endregion dtpCSTime.Value = DateTime.Now.AddMonths(-1); dtpCETime.Value = DateTime.Now; dgvData.ReadOnly = false; foreach (DataGridViewColumn dgvc in dgvData.Columns) { if (dgvc == colCheck) { continue; } dgvc.ReadOnly = true; } BindPageData(); }
private void UCCompanyAddOrEdit_Load(object sender, EventArgs e) { SetBtnStatus(); CommonCtrl.BindComboBoxByDictionarr(cborepair_qualification, "sys_repair_qualification", true); //维修资质 CommonCtrl.BindComboBoxByDictionarr(cbounit_properties, "sys_enterprise_property", true); //单位性质 CommonFuncCall.BindProviceComBox(cboprovince, "请选择"); if (this.dr != null) { txtcom_code.Caption = this.dr["com_code"].ToString(); //公司编码 txtcom_name.Caption = this.dr["com_name"].ToString(); //公司全名 txtcom_short_name.Caption = this.dr["com_short_name"].ToString(); //公司简称 cborepair_qualification.SelectedValue = this.dr["repair_qualification"].ToString(); //维修资质 cbounit_properties.SelectedValue = this.dr["unit_properties"].ToString(); //单位性质 txtlegal_person.Caption = this.dr["legal_person"].ToString(); //法人负责人 txtcertificate_code.Caption = this.dr["certificate_code"].ToString(); //组织机构代码 txtzip_code.Caption = this.dr["zip_code"].ToString(); //邮编 cboprovince.SelectedValue = this.dr["province"].ToString(); //省份 cbocity.SelectedValue = this.dr["city"].ToString(); //城市 cbocounty.SelectedValue = this.dr["county"].ToString(); //区县 txtcom_address.Caption = this.dr["com_address"].ToString(); //详细地址 txtcom_tel.Caption = this.dr["com_tel"].ToString(); //固话 txtcom_phone.Caption = this.dr["com_phone"].ToString(); //手机 txtcom_email.Caption = this.dr["com_email"].ToString(); //电子邮件 txtcom_fax.Caption = this.dr["com_fax"].ToString(); //传真 txttax_account.Caption = this.dr["tax_account"].ToString(); //税号 txttax_qualification.Caption = this.dr["tax_qualification"].ToString(); //纳税人资格 ckbindepen_check.Checked = this.dr["indepen_check"].ToString() == "1" ? true : false; //独立核算 0 为否 1为是 ckbindepen_legalperson.Checked = this.dr["indepen_legalperson"].ToString() == "1" ? true : false; //独立法人 0 为否 1为是 ckbfinancial_indepen.Checked = this.dr["financial_indepen"].ToString() == "1" ? true : false; // 财务独立 0 为否 1为是 txtremark.Caption = this.dr["remark"].ToString(); //备注 if (!string.IsNullOrEmpty(this.dr["work_time"].ToString())) { long time = 0; if (long.TryParse(this.dr["work_time"].ToString(), out time)) { dtpwork_time.Value = Common.UtcLongToLocalDateTime(time);//上班时间 } } txtser_car_num.Caption = this.dr["ser_car_num"].ToString(); //服务车数 chkis_repair_newenergy.Checked = this.dr["is_repair_newenergy"].ToString() == "1" ? true : false; // 是否维修新能源 0 为否 1为是 chkis_repair_ng.Checked = this.dr["is_repair_ng"].ToString() == "1" ? true : false; // 是否维修NG车 0 为否 1为是 txtstaff_counts.Caption = this.dr["staff_counts"].ToString(); //人员总数 txtser_staff_counts.Caption = this.dr["ser_staff_counts"].ToString(); //服务人员数 txtmach_repair_staff_counts.Caption = this.dr["mach_repair_staff_counts"].ToString(); //机器人数 txtholder_electrician_counts.Caption = this.dr["holder_electrician_counts"].ToString(); //持证电工数 txttrench_counts.Caption = this.dr["trench_counts"].ToString(); //地沟\举升机数 txttwelve_trench_counts.Caption = this.dr["twelve_trench_counts"].ToString(); //标准地沟\举升机数 txtfour_location_counts.Caption = this.dr["four_location_counts"].ToString(); //四轮定位仪数 txtengine_test_counts.Caption = this.dr["engine_test_counts"].ToString(); //发动机检测仪数 txtfactory_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["factory_area"].ToString(), 2); //厂区占地面积 txtparking_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["parking_area"].ToString(), 2); //停车区面积 txtreception_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["reception_area"].ToString(), 2); //接待室面积 txtcust_lounge_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["cust_lounge_area"].ToString(), 2); //客户休息室面积 txtcust_toilet_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["cust_toilet_area"].ToString(), 2); //客户洗手间面积 txtmeeting_room_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["meeting_room_area"].ToString(), 2); //会议室面积 txttraining_room_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["training_room_area"].ToString(), 2); //培训室面积 txtsettlement_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["settlement_area"].ToString(), 2); //结算区面积 txtrepaired_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["repaired_area"].ToString(), 2); //待修区面积 txtcheck_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["check_area"].ToString(), 2); //检查区面积 txtrepair_workshop_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["repair_workshop_area"].ToString(), 2); //维修车间面积 txtbig_repaired_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["big_repaired_area"].ToString(), 2); //总成大修面积 txtparts_sales_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["parts_sales_area"].ToString(), 2); //配件销售面积 txtparts_warehouse_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["parts_warehouse_area"].ToString(), 2); //配件仓库面积 txtoldparts_warehouse_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["oldparts_warehouse_area"].ToString(), 2); //旧件仓库面积 txtrepair_instructions.Caption = this.dr["repair_instructions"].ToString(); //维修说明 } }
//初始化 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() { #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; 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 BindControls() { //CommonCtrl.BindComboBoxByDictionarr(cboDataSource, "sys_data_source", false);//绑定数据源 CommonCtrl.BindComboBoxByDictionarr(cboBrand, "sys_vehicle_brand", false); //绑定车型品牌 CommonCtrl.BindComboBoxByDictionarr(cboType, "sys_vehicle_model_category", false); //绑定车型类型 }
//初始化 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 设置功能按钮可见性 UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection <ButtonEx_sms>() { btnSave, btnCancel, btnSet, btnView, btnPrint }); #endregion #region 初始化数据绑定 CommonCtrl.BindComboBoxByDictionarr(cbo_cb_Callback_type, "sys_callback_type", false); //绑定反馈类型 CommonCtrl.BindComboBoxByDictionarr(cbo_cb_Callback_mode, "sys_callback_mode", false); //绑定反馈方式 CommonCtrl.BindComboBoxByDictionarr(cbo_cust_type, "sys_customer_category", false); //客户类别 CommonCtrl.BindComboBoxByDictionarr(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); //客户类别 dtp_cb_Callback_time.Value = DBHelper.GetCurrentTime(); dtp_member_period_validity.Value = DBHelper.GetCurrentTime(); #endregion lbl_cb_create_by.Text = GlobalStaticObj.UserName; lbl_cb_create_by.Tag = GlobalStaticObj.UserID; if (windowStatus == WindowStatus.Edit || windowStatus == WindowStatus.View) { SetFeedbackInfo(); SetCustInfo(); SetContInfo(); } 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_phone.Caption = frmContacts.contPhone; } SetContInfo(); }; #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 #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("Feedback_id", Guid.NewGuid().ToString()); //客户ID } else if (windowStatus == WindowStatus.Edit) { dicFileds.Add("update_by", GlobalStaticObj.UserID); //最后编辑人 dicFileds.Add("update_time", DBHelper.GetCurrentTime().Ticks.ToString()); //最后编辑时间 } dicFileds.Add("corp_id", txt_cust_code.Tag.ToString()); //客户ID dicFileds.Add("Feedback_time", DBHelper.GetCurrentTime().Ticks.ToString()); //反馈时间 dicFileds.Add("Feedback_type", cbo_cb_Callback_type.SelectedValue.ToString()); //反馈类型 dicFileds.Add("Feedback_mode", cbo_cb_Callback_mode.SelectedValue.ToString()); //反馈方式 dicFileds.Add("title", txt_cb_title.Caption); //反馈标题 dicFileds.Add("record", rtx_cb_record.Text); //反馈内容 dicFileds.Add("Feedback_by", txt_cb_Callback_by.Tag.ToString()); //反馈人员名称 dicFileds.Add("Feedback_phone", txt_cb_Callback_by_phone.Caption); //被反馈人电话 //dicFileds.Add("status", "1"); //数据状态 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_Feedback", "Feedback_id", FeedbackId, dicFileds); } catch (Exception ex) { result = false; } MessageBoxEx.Show(result ? "保存成功!" : "保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); if (result) { UCFeedbakcManager.BindPageData(); deleteMenuByTag(Tag.ToString(), UCFeedbakcManager.Name); } }; #endregion #endregion }
private void UCCompanyView_Load(object sender, EventArgs e) { // base.RoleButtonStstus(uc.Name);//角色按钮权限-是否隐藏 //base.SetBtnStatus(wStatus); //CommonCtrl.BindComboBoxByDictionarr(cbostatus, "sys_data_status", true);//绑定状态 启用 停用 //CommonCtrl.BindComboBoxByDictionarr(cbodata_sources, "sys_data_source", true);//数据来源 自建 宇通 DataSources.BindComBoxDataEnum(cbostatus, typeof(DataSources.EnumStatus), true); //绑定状态 启用 停用 DataSources.BindComBoxDataEnum(cbodata_sources, typeof(DataSources.EnumDataSources), true); //数据来源 自建 宇通 CommonCtrl.BindComboBoxByDictionarr(cborepair_qualification, "sys_repair_qualification", true); //维修资质 CommonCtrl.BindComboBoxByDictionarr(cbounit_properties, "sys_enterprise_property", true); //单位性质 CommonFuncCall.BindProviceComBox(cboprovince, "请选择"); string strSql = "select c.*,(select USER_NAME from sys_user where user_id =c.create_by )as create_Username , " + "(select USER_NAME from sys_user where user_id =c.update_by ) as update_username from tb_company c where c.com_id='" + id + "'"; SQLObj sqlobj = new SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, ParamObj>(); sqlobj.sqlString = strSql; DataSet ds = DBHelper.GetDataSet("查询公司", sqlobj); //DBHelper.GetTable("查询公司", "tb_company", "*", "com_id='" + id + "'", "", ""); if (ds == null || ds.Tables[0].Rows.Count <= 0) { MessageBoxEx.Show("查询公司失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataTable dt = ds.Tables[0]; lblcom_code.Text = dt.Rows[0]["com_code"].ToString(); //公司编码 lblcom_name.Text = dt.Rows[0]["com_name"].ToString(); //公司全名 lblcom_short_name.Text = dt.Rows[0]["com_short_name"].ToString(); //公司简称 cborepair_qualification.SelectedValue = dt.Rows[0]["repair_qualification"].ToString(); //维修资质 cbounit_properties.SelectedValue = dt.Rows[0]["unit_properties"].ToString(); //单位性质 lbllegal_person.Text = dt.Rows[0]["legal_person"].ToString(); //法人负责人 lblcertificate_code.Text = dt.Rows[0]["certificate_code"].ToString(); //组织机构代码 lblzip_code.Text = dt.Rows[0]["zip_code"].ToString(); //邮编 cboprovince.SelectedValue = dt.Rows[0]["province"].ToString(); //省份 cbocity.SelectedValue = dt.Rows[0]["city"].ToString(); //城市 cbocounty.SelectedValue = dt.Rows[0]["county"].ToString(); //区县 lblcom_address.Text = dt.Rows[0]["com_address"].ToString(); //详细地址 lblcom_tel.Text = dt.Rows[0]["com_tel"].ToString(); //固话 lblcom_phone.Text = dt.Rows[0]["com_phone"].ToString(); //手机 lblcom_email.Text = dt.Rows[0]["com_email"].ToString(); //电子邮件 lblcom_fax.Text = dt.Rows[0]["com_fax"].ToString(); //传真 lbltax_account.Text = dt.Rows[0]["tax_account"].ToString(); //税号 lbltax_qualification.Text = dt.Rows[0]["tax_qualification"].ToString(); //纳税人资格 ckbindepen_check.Checked = dt.Rows[0]["indepen_check"].ToString() == "1" ? true : false; //独立核算 0 为否 1为是 ckbindepen_legalperson.Checked = dt.Rows[0]["indepen_legalperson"].ToString() == "1" ? true : false; //独立法人 0 为否 1为是 ckbfinancial_indepen.Checked = dt.Rows[0]["financial_indepen"].ToString() == "1" ? true : false; // 财务独立 0 为否 1为是 lblremark.Text = dt.Rows[0]["remark"].ToString(); lblcreate_by.Text = dt.Rows[0]["create_Username"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["create_time"].ToString())) { lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["create_time"].ToString())).ToString(); } lblupdate_by.Text = dt.Rows[0]["update_username"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["update_time"].ToString())) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["update_time"].ToString())).ToString(); } cbostatus.SelectedValue = dt.Rows[0]["status"].ToString(); cbodata_sources.SelectedValue = dt.Rows[0]["data_source"].ToString(); long time = 0; if (!string.IsNullOrEmpty(dt.Rows[0]["work_time"].ToString()) && long.TryParse(dt.Rows[0]["work_time"].ToString(), out time)) { lblwork_time.Text = Common.UtcLongToLocalDateTime(time).ToString();//上班时间 } lblser_car_num.Text = dt.Rows[0]["ser_car_num"].ToString(); //服务车数 chkis_repair_newenergy.Checked = dt.Rows[0]["is_repair_newenergy"].ToString() == "1" ? true : false; // 是否维修新能源 0 为否 1为是 chkis_repair_ng.Checked = dt.Rows[0]["is_repair_ng"].ToString() == "1" ? true : false; // 是否维修NG车 0 为否 1为是 lblstaff_counts.Text = dt.Rows[0]["staff_counts"].ToString(); //人员总数 lblser_staff_counts.Text = dt.Rows[0]["ser_staff_counts"].ToString(); //服务人员数 lblmach_repair_staff_counts.Text = dt.Rows[0]["mach_repair_staff_counts"].ToString(); //机器人数 lblholder_electrician_counts.Text = dt.Rows[0]["holder_electrician_counts"].ToString(); //持证电工数 lbltrench_counts.Text = dt.Rows[0]["trench_counts"].ToString(); //地沟\举升机数 lbltwelve_trench_counts.Text = dt.Rows[0]["twelve_trench_counts"].ToString(); //标准地沟\举升机数 lblfour_location_counts.Text = dt.Rows[0]["four_location_counts"].ToString(); //四轮定位仪数 lblengine_test_counts.Text = dt.Rows[0]["engine_test_counts"].ToString(); //发动机检测仪数 lblfactory_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["factory_area"].ToString(), 2); //厂区占地面积 lblparking_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["parking_area"].ToString(), 2); //停车区面积 lblreception_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["reception_area"].ToString(), 2); //接待室面积 lblcust_lounge_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["cust_lounge_area"].ToString(), 2); //客户休息室面积 lblcust_toilet_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["cust_toilet_area"].ToString(), 2); //客户洗手间面积 lblmeeting_room_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["meeting_room_area"].ToString(), 2); //会议室面积 lbltraining_room_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["training_room_area"].ToString(), 2); //培训室面积 lblsettlement_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["settlement_area"].ToString(), 2); //结算区面积 lblrepaired_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["repaired_area"].ToString(), 2); //待修区面积 lblcheck_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["check_area"].ToString(), 2); //检查区面积 lblrepair_workshop_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["repair_workshop_area"].ToString(), 2); //维修车间面积 lblbig_repaired_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["big_repaired_area"].ToString(), 2); //总成大修面积 lblparts_sales_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["parts_sales_area"].ToString(), 2); //配件销售面积 lblparts_warehouse_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["parts_warehouse_area"].ToString(), 2); //配件仓库面积 lbloldparts_warehouse_area.Text = CommonUtility.DecimalRightZeroFill(dt.Rows[0]["oldparts_warehouse_area"].ToString(), 2); //旧件仓库面积 lblrepair_instructions.Text = dt.Rows[0]["repair_instructions"].ToString(); //维修说明 ArrayList al = new ArrayList(); al.Add("sys_post");//岗位 dtdic = CommonFuncCall.GetDictionariesByPDic_codes(al); //DataTable dt_user = DBHelper.GetTable("查询公司人员信息", "v_User", "*", "com_id='" + id + "'", "", "order by create_time"); DataTable dt_user = DBHelper.GetTable("查询公司人员信息", "v_User", "*", "com_name='" + id + "'", "", "order by create_time"); if (dt_user != null) { dgvUser.DataSource = dt_user.DefaultView; } SetSysManageViewBtn(); }