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); //数据来源 }
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(); }
/// <summary> /// 绑定下拉框信息 /// </summary> void BindDllInfo() { ddlSupplierType.Items.Clear(); ddlCompanyNature.Items.Clear(); ddlState.Items.Clear(); //绑定供应商分类 CommonFuncCall.BindComBoxDataSource(ddlSupplierType, "sys_supplier_category", "全部"); //绑定企业性质类型 CommonFuncCall.BindComBoxDataSource(ddlCompanyNature, "sys_enterprise_property", "全部"); CommonFuncCall.BindProviceComBox(ddlProvince, "全部"); CommonFuncCall.BindCityComBox(ddlCity, "", "全部"); CommonFuncCall.BindCountryComBox(ddlArea, "", "全部"); ddlState.DataSource = DataSources.EnumToList(typeof(DataSources.EnumStatus), true); ddlState.ValueMember = "Value"; ddlState.DisplayMember = "Text"; }
/// <summary> /// 绑定下拉框信息 /// </summary> private void BindDllInfo() { ddlsup_type.Items.Clear(); ddlunit_properties.Items.Clear(); ddlcredit_class.Items.Clear(); ddlprice_type.Items.Clear(); //绑定供应商分类 CommonFuncCall.BindComBoxDataSource(ddlsup_type, "sys_supplier_category", "请选择"); //绑定企业性质类型 CommonFuncCall.BindComBoxDataSource(ddlunit_properties, "sys_enterprise_property", "请选择"); //绑定信用等级类型 CommonFuncCall.BindComBoxDataSource(ddlcredit_class, "sys_enterprise_credit_class", "请选择"); //绑定价格商类型 CommonFuncCall.BindComBoxDataSource(ddlprice_type, "sys_price_type", "请选择"); CommonFuncCall.BindProviceComBox(ddlprovince, "请选择"); CommonFuncCall.BindCityComBox(ddlcity, "", "请选择"); CommonFuncCall.BindCountryComBox(ddlcounty, "", "请选择"); }
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() { #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 }
/// <summary> /// 绑定下拉框信息 /// </summary> private void BindDllInfo() { CommonFuncCall.BindProviceComBox(ddlprovince, "请选择"); CommonFuncCall.BindCityComBox(ddlcity, "", "请选择"); CommonFuncCall.BindCountryComBox(ddlcounty, "", "请选择"); }
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(); }
//初始化 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 }