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"; //单据类型
 }
예제 #2
0
 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;
     }
 }
 //往来单位1选择器
 private void txtcCustName1_ChooserClick(object sender, EventArgs e)
 {
     if (cboOrderType.SelectedValue == null)
     {
         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;
                 cust_code1 = frmCustomer.strCustomerNo;
                 txtcCustName1.Text = frmCustomer.strCustomerName;
                 if (txtcCustName2.Tag == null && enumAccount != DataSources.EnumAccountVerification.YingShouToYingFu)//没有选择应收客户,默认选择与预收客户相同
                 {
                     txtcCustName2.Tag = frmCustomer.strCustomerId;
                     cust_code2 = frmCustomer.strCustomerNo;
                     txtcCustName2.Text = frmCustomer.strCustomerName;
                 }
                 if (txtAdvanceBalance.Visible)
                 {
                     txtAdvanceBalance.Caption = DBOperation.WaiLaiYuE(frmCustomer.strCustomerId, DataSources.EnumOrderType.RECEIVABLE).ToString();
                 }
             }
             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;
                 cust_code1 = frmSupp.supperCode;
                 txtcCustName1.Text = frmSupp.supperName;
                 if (txtcCustName2.Tag == null && enumAccount != DataSources.EnumAccountVerification.YingFuToYingShou)
                 {
                     txtcCustName2.Tag = frmSupp.supperID;
                     cust_code2 = frmSupp.supperCode;
                     txtcCustName2.Text = frmSupp.supperName;
                 }
                 if (txtAdvanceBalance.Visible)
                 {
                     txtAdvanceBalance.Caption = DBOperation.WaiLaiYuE(frmSupp.supperID, DataSources.EnumOrderType.PAYMENT).ToString();
                 }
             }
             break;
     }
 }
 //往来单位2选择器
 private void txtcCustName2_ChooserClick(object sender, EventArgs e)
 {
     if (cboOrderType.SelectedValue == null)
     {
         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;
                 cust_code2 = frmCustomer.strCustomerNo;
                 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;
                 cust_code2 = frmSupp.supperCode;
                 txtcCustName2.Text = frmSupp.supperName;
             }
             break;
     }
 }
        private void InitControlDataSource() //初始化数据字段控件数据
        {
            try
            {
                #region 设置控件验证值
                txt_repairer_mobile.VerifyTypeName = txt_link_man_mobile.VerifyTypeName = "Phone";
                txt_repairer_mobile.ShowError = txt_link_man_mobile.ShowError = true;
                txt_customer_postcode.VerifyTypeName = "Postcode";
                txt_customer_postcode.ShowError = true;
                txt_feedback_num.VerifyTypeName = "Integer";
                txt_feedback_num.ShowError = true;
                txt_other_money.VerifyTypeName = txt_man_hour_subsidy.VerifyTypeName = txt_ccf.VerifyTypeName = txt_journey_subsidy.VerifyTypeName = txt_maintain_mileage.VerifyTypeName = txt_travel_mileage.VerifyTypeName = "UFloat";
                txt_other_money.ShowError = txt_man_hour_subsidy.ShowError = txt_ccf.ShowError = txt_journey_subsidy.ShowError = txt_maintain_mileage.ShowError = txt_travel_mileage.ShowError = true;
                #endregion

                dtp_goout_back_time.Value = dtp_goout_time.Value = dtp_maintain_time.Value = dtp_parts_buy_time.Value = dtp_repairs_time.Value = dtp_start_work_time.Value = dtp_complete_work_time.Value = DBHelper.GetCurrentTime();
                dgv_tb_maintain_three_guaranty_accessory.TableName = "tb_maintain_three_guaranty";
                dgv_tb_maintain_three_guaranty_accessory.TableNameKeyValue = TgId;

                #region 基础数据
                var isSecondStation = DBHelper.GetSingleValue("根据公司编码获取是否为二级站", GlobalStaticObj.CommAccCode, "tb_company", "category", "sap_code = '" + GlobalStaticObj.ServerStationCode+ "'", "");
                if (!String.IsNullOrEmpty(isSecondStation))
                {
                    chk_whether_second_station_true.Checked = isSecondStation == "1";    //一级站
                    chk_whether_second_station_false.Checked = isSecondStation == "2";    //二级站
                }
                txt_service_station_code.Text = GlobalStaticObj.ServerStationCode; //当前服务站代码
                txt_service_station_name.Caption = GlobalStaticObj.ServerStationName; //当前服务站名称

                dtp_repairs_time.Value = DateTime.Now;  //报修日期(系统默认当前时间)

                //txt_service_station_code.ChooserClick += delegate   //服务站选择器
                //{
                //    var signInfoChooser = new FormSignInfoChooser();
                //    var result = signInfoChooser.ShowDialog();
                //    if (result != DialogResult.OK) return;
                //    txt_service_station_code.Text = signInfoChooser.SignCode;
                //    txt_service_station_code.Tag = signInfoChooser.SignId;
                //    txt_service_station_name.Caption = signInfoChooser.SignName;
                //};

                CommonCtrl.CmbBindDict(cbo_receipt_type, "bill_type_yt", false);   //宇通单据类型
                CommonCtrl.CmbBindDict(cbo_cost_type_service_zczg, "cost_type_care_policy_yt", false);   //费用类型(政策照顾)
                CommonCtrl.BindComboBoxByTable(cbo_product_notice_no, "tb_product_no", "service_code", "activities", false);   //产品改进通知

                CommonCtrl.CmbBindDict(cbo_whether_go_out, "sys_true_false", false);   //是否外出
                cbo_whether_go_out.SelectedValue = DbDic2Enum.FALSE;    //是否外出(默认选择为否)

                CommonCtrl.CmbBindDict(cbo_refit_case, "refit_case", false);   //改装情况
                cbo_refit_case.SelectedValue = DbDic2Enum.REFIT_CASE_FALSE;    //改装请款(默认选择为无改装)

                DataSources.BindComBoxDataEnum(cbo_promise_guarantee, typeof(DataSources.EnumYesNo), false);   //特殊约定质保
                cbo_promise_guarantee.SelectedValue = DataSources.EnumYesNo.NO;    //特殊约定质保(默认选择为否)
                UIAssistants.BindingServiceStationUser(cbo_approver_name_yt, true, "请选择");

                txt_appraiser_name.ChooserClick += delegate   //鉴定人选择器
                {
                    var chooser = new frmUsers{ cbo_data_source = { SelectedValue = "1", Enabled = false } };
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    if (String.IsNullOrEmpty(chooser.User_Name) || String.IsNullOrEmpty(chooser.CrmId))
                    {
                        MessageBoxEx.Show("无效的数据,获取不到用户的CRM信息");
                        return;
                    }
                    //txt_approver_name_yt.Text = chooser.contName;
                    //txt_approver_name_yt.Tag = chooser.crmId;
                    txt_appraiser_name.Text = chooser.User_Name;
                    txt_appraiser_name.Tag = chooser.CrmId;
                };

                txt_repair_man.ChooserClick += delegate   //维修人选择器
                {
                    var chooser = new frmUsers{ cbo_data_source = { SelectedValue = "1", Enabled = false } };
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    if (String.IsNullOrEmpty(chooser.User_Name) || String.IsNullOrEmpty(chooser.CrmId))
                    {
                        MessageBoxEx.Show("无效的数据,获取不到用户的CRM信息");
                        return;
                    }
                    //txt_approver_name_yt.Text = chooser.contName;
                    //txt_approver_name_yt.Tag = chooser.crmId;
                    txt_repair_man.Text = chooser.User_Name;
                    txt_repair_man.Tag = chooser.CrmId;
                };

                CommonCtrl.BindComboBoxByTable(cbo_cost_type_service_fwhd, "tb_product_no", "service_code", "activities", false);   //费用类型(服务活动) unknow

                CommonCtrl.CmbBindDict(cbo_customer_property, "custom_property_yt", false);   //客户性质
                txt_vehicle_use_corp.ChooserClick += delegate  //车辆使用单位选择器
                {
                    var custChooser = new frmCustomerInfo();
                    var result = custChooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        if (String.IsNullOrEmpty(custChooser.CustomerInfo.CustName) || String.IsNullOrEmpty(custChooser.CustomerInfo.SAPCode))
                        {
                            MessageBoxEx.Show("选择的数据不符合使用要求");
                            return;
                        }
                        txt_vehicle_use_corp.Text = custChooser.CustomerInfo.CustName;
                        txt_vehicle_use_corp.Tag = custChooser.CustomerInfo.SAPCode;
                    }
                };
                txt_customer_code.ChooserClick += delegate  //客户信息选择器
                {
                    var custChooser = new frmCustomerInfo();
                    var result = custChooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        if (String.IsNullOrEmpty(custChooser.CustomerInfo.CustCode))
                        {
                            MessageBoxEx.Show("选择的数据不符合使用要求");
                            return;
                        }
                        txt_customer_code.Text = custChooser.CustomerInfo.CustCode;
                        txt_customer_code.Tag = custChooser.CustomerInfo.CustId;
                        txt_customer_name.Caption = custChooser.CustomerInfo.CustName;
                        txt_customer_address.Caption = custChooser.CustomerInfo.CustAddress;
                        txt_customer_postcode.Caption = custChooser.CustomerInfo.ZipCode;

                        //联系人数据                
                        var dpt = DBHelper.GetTable("联系人数据", "(select tr.relation_object_id, tr.is_default tr_is_default, tb.*  from tb_contacts tb inner join tr_base_contacts tr on tb.cont_id = tr.cont_id) a", "*",
                            string.Format(" a.relation_object_id='{0}'", custChooser.CustomerInfo.CustId), "", "");
                        if (dpt != null && dpt.Rows.Count > 0)
                        {
                            for (var i = 0; i < dpt.Rows.Count; i++)
                            {
                                var dpr = dpt.Rows[i];
                                if (CommonCtrl.IsNullToString(dpr["tr_is_default"]) == "1")
                                {
                                    txt_linkman.Caption = CommonCtrl.IsNullToString(dpr["cont_name"]);
                                    txt_link_man_mobile.Caption = CommonCtrl.IsNullToString(dpr["cont_phone"]);
                                }
                            }
                        }
                        ValidationCustomer();
                    }
                };
                txt_customer_code.Leave += delegate     //客户信息校验
                {
                    ValidationCustomer();
                };
                #endregion

                #region 车辆信息
                CommonCtrl.BindComboBoxByDictionarr(cbo_fault_cause, "cause_fault_yt", false);   //故障原因
                CommonCtrl.BindComboBoxByDictionarr(cbo_fault_duty_corp, "fault_company_yt", false);   //故障责任单位
                txt_vehicle_no.ChooserClick += delegate  //车辆选择器
                {
                    var chooser = new frmVehicleGrade();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_no.Text = chooser.strLicensePlate; //车牌号
                    txt_depot_no.Text = chooser.Turner;  //车工号
                    txt_vehicle_vin.Caption = chooser.strVIN;   //VIN
                    txt_engine_num.Caption = chooser.strEngineNum; //发动机号
                    txt_vehicle_model.Tag = chooser.strModel;  //车型
                    ValidationVehicle();
                    //txt_maintain_mileage.Caption = chooser.MaintainMileage; //协议保养里程
                    //txt_maintain_time.Caption = chooser.MaintainTime;    //协议保养日期
                };
                txt_depot_no.ChooserClick += delegate  //车工号选择器
                {
                    var chooser = new frmVehicleGrade();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_no.Text = chooser.strLicensePlate; //车牌号
                    txt_depot_no.Text = chooser.Turner;  //车工号
                    txt_vehicle_vin.Caption = chooser.strVIN;   //VIN
                    txt_engine_num.Caption = chooser.strEngineNum; //发动机号
                    txt_vehicle_model.Tag = chooser.strModel;  //车型
                    ValidationDepto();
                    //txt_maintain_mileage.Caption = chooser.MaintainMileage; //协议保养里程
                    //txt_maintain_time.Caption = chooser.MaintainTime;    //协议保养日期
                };
                txt_vehicle_no.Leave += delegate     //车辆信息校验
                {
                    //ValidationVehicle();
                };
                txt_depot_no.Leave += delegate     //车辆信息校验
                {
                    ValidationDepto();
                };

                txt_vehicle_model.ChooserClick += delegate  //车型选择器
                {
                    var chooser = new frmVehicleModels();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_vehicle_model.Text = chooser.VMName;  //车型
                    txt_vehicle_model.Tag = chooser.VMID;
                    _vmClass = chooser.VMClass;
                };

                txt_fault_system.ChooserClick += delegate  //故障系统选择器
                {
                    var chooser = new FormChooserFault();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;

                    txt_fault_system.Text = chooser.SystemName;
                    txt_fault_system.Tag = chooser.SystemCode;
                    txt_fault_assembly.Caption = chooser.AssemblyName;
                    txt_fault_assembly.Tag = chooser.AssemblyCode;
                    txt_fault_part.Caption = chooser.PartmName;
                    txt_fault_part.Tag = chooser.PartCode;
                    //txt_fault_schema.Text = chooser.SchemaName;
                    //txt_fault_schema.Tag = chooser.SchemaCode;

                };
                txt_fault_schema.ChooserClick += delegate  //故障模式选择器
                {
                    var chooser = new FormChooserFaultModel();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_fault_schema.Text = chooser.FmeaName;
                    txt_fault_schema.Tag = chooser.FmeaCode;
                };
                #endregion

                #region 外出信息
                CommonCtrl.BindComboBoxByDictionarr(cbo_whether_yt, "sys_true_false", false);   //是否宇通车
                if(cbo_whether_yt.Items.Contains("0")) cbo_whether_yt.SelectedValue = "0";
                CommonCtrl.BindComboBoxByDictionarr(cbo_means_traffic, "traffic_mode_yt", false);   //外出交通方式
                if (cbo_means_traffic.Items.Count > 0) cbo_means_traffic.SelectedIndex = 0;
                cbo_means_traffic.SelectedIndexChanged += delegate
                {
                    if (CommonCtrl.IsNullToString(cbo_means_traffic.SelectedValue) ==
                        DbDic2Enum.TRAFFIC_MODE_YT_100000000)
                    {
                        txt_journey_subsidy.Enabled = false;
                    }
                    else
                    {
                        txt_journey_subsidy.Enabled = true;
                    }
                };

                UIAssistants.BindingServiceStationUser(cbo_goout_approver, true, "请选择"); //外出批准人选择器
                
                #endregion

                #region 配件信息
                dtp_parts_buy_time.Value = DateTime.Now;
                //txt_parts_buy_corp.ChooserClick += delegate  //配件购买单位(客户选择器)
                //{
                //    var custChooser = new frmChooseCompany();
                //    var result = custChooser.ShowDialog();
                //    if (result == DialogResult.OK)
                //    {
                //        txt_parts_buy_corp.Text = custChooser.Sap_Code;
                //    }
                //};
                CommonCtrl.BindComboBoxByDictionarr(cbo_contain_man_hour_cost, "sys_true_false", false);   //是否包含工时费
                cbo_contain_man_hour_cost.SelectedValue = DbDic2Enum.TRUE;

                txt_parts_code.ChooserClick += delegate  //配件编号(配件选择器)
                {
                    var chooser = new frmParts();
                    var result = chooser.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        txt_parts_code.Text = chooser.CarPartsCode;
                        txt_materiel_describe.Caption = chooser.PartsName;
                    }
                };
                //txt_first_install_station.ChooserClick += delegate  //首次安装服务站(客户选择器)
                //{
                //    var custChooser = new frmChooseCompany();
                //    var result = custChooser.ShowDialog();
                //    if (result == DialogResult.OK)
                //    {
                //        txt_first_install_station.Text = custChooser.Sap_Code;
                //    }
                //};
                CommonCtrl.BindComboBoxByDictionarr(cbo_part_guarantee_period, "parts_warranty_agreement_yt", false);   //协议保养日期
                #endregion

                #region 经办人
                txt_responsible_opid.ChooserClick += delegate   //经办人选择器
                {
                    var chooser = new frmUsers();
                    var result = chooser.ShowDialog();
                    if (result != DialogResult.OK) return;
                    txt_responsible_opid.Text = chooser.User_Name;
                    txt_responsible_opid.Tag = chooser.User_ID;
                    txt_org_name.Caption = chooser.OrgName;
                    txt_org_name.Tag = chooser.OrgId;
                };
                #endregion
            }
            catch (Exception 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);  //宇通单据状态
 }
예제 #8
0
        //初始化
        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();
        }
예제 #9
0
 /// <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;
     }
 }
 //往来单位1选择器
 private void txtcCustName1_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.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;
     }
 }
예제 #11
0
        /// <summary>
        /// 客户编码选择器事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtCustomNO_ChooserClick(object sender, EventArgs e)
        {
            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;

                #region 会员信息
                DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + txtCustomNO.Tag + "'", "", "");
                if (dct.Rows.Count > 0)
                {
                    DataRow dcr = dct.Rows[0];
                    txtMemberNo.Caption = CommonCtrl.IsNullToString(dcr["member_number"]);
                    txtMemberGrade.Caption = GetDicName(CommonCtrl.IsNullToString(dcr["member_class"]));
                    txtMemberPZk.Caption = CommonCtrl.IsNullToString(dcr["workhours_discount"]);
                    txtMemberLZk.Caption = CommonCtrl.IsNullToString(dcr["accessories_discount"]);
                }
                else
                {
                    txtMemberNo.Caption = string.Empty;
                    txtMemberGrade.Caption = string.Empty;
                    txtMemberPZk.Caption = string.Empty;
                    txtMemberLZk.Caption = string.Empty;
                }
                #endregion
            }
        }
예제 #12
0
        /// <summary> 选择客户编码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtcust_code1_ChooserClick(object sender, EventArgs e)
        {
            frmCustomerInfo chooseSupplier = new frmCustomerInfo();
            chooseSupplier.ShowDialog();
            cust_id = chooseSupplier.strCustomerId;
            if (!string.IsNullOrEmpty(cust_id))
            {
                cust_code = chooseSupplier.strCustomerNo;
                txtcust_code1.Text = chooseSupplier.strCustomerNo;
                txtcust_name.Caption = chooseSupplier.strCustomerName;
                txtclosing_unit1.Text = chooseSupplier.strCustomerName;

                DataTable dt = DBHelper.GetTable("查询客户档案信息", "tb_customer", "*", " enable_flag != 0 and cust_id='" + cust_id + "'", "", "");
                if (dt.Rows.Count > 0)
                {
                    txtfax.Caption = dt.Rows[0]["cust_fax"].ToString();
                    txtcontacts_tel.Caption = dt.Rows[0]["cust_tel"].ToString();
                }
                string TableName = string.Format(@"(
                                                    select cont_name from tb_contacts where cont_id=
                                                    (select cont_id from tr_base_contacts where relation_object_id='{0}' and is_default='1')
                                                    ) tb_conts", cust_id);
                DataTable dt_conts = DBHelper.GetTable("查询客户默认的联系人信息", TableName, "*", "", "", "");
                if (dt_conts != null && dt_conts.Rows.Count > 0)
                {
                    txtcontacts.Caption = dt_conts.Rows[0]["cont_name"].ToString();
                }
                else
                { txtcontacts.Caption = string.Empty; }
            }
        }
예제 #13
0
 //选择器
 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 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);  //宇通单据状态
        }
예제 #15
0
        /// <summary>
        /// 按维修项目查询-客户编码选择器事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtPartCustomCode_ChooserClick(object sender, EventArgs e)
        {
            frmCustomerInfo frmCInfo = new frmCustomerInfo();
            DialogResult result = frmCInfo.ShowDialog();
            if (result == DialogResult.OK)
            {
                txtPartCustomCode.Text = frmCInfo.strCustomerNo;
                txtPartCustomCode.Tag = frmCInfo.strCustomerId;

            }
        }
        /// <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;
                    #region 会员信息
                    DataTable dct = DBHelper.GetTable("获取会员信息", "tb_customer", "member_number,member_class,accessories_discount,workhours_discount", " is_member='1' and cust_id='" + txtCustomNO.Tag + "'", "", "");
                    if (dct.Rows.Count > 0)
                    {
                        DataRow dcr = dct.Rows[0];
                        strMemberPZk = CommonCtrl.IsNullToString(dcr["workhours_discount"]);
                        strMemberLZk = CommonCtrl.IsNullToString(dcr["accessories_discount"]);
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);

            }
        }
예제 #17
0
        //初始化
        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.windowStatus = WindowStatus.Add;
                uc.addUserControl(uc, "会员管理-新增", "UCMemberAdd", Tag.ToString(), Name);
            };
            #endregion

            #region 编辑数据
            EditEvent += delegate
            {
                if (dgvQData.SelectedRows.Count > 0)
                {
                    var uc = new UCMemberAddOrEdit();
                    uc.windowStatus = WindowStatus.Edit;
                    uc.UCMemberManager = this;
                    var dataView = GetSelectedRowData();
                    var listField = GetCheckRows();
                    if (dataView != null && listField.Count > 0)
                    {
                        var selectedData = dataView[0];
                        uc.VipId = CommonCtrl.IsNullToString(selectedData["vip_id"]);
                        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 result = MessageBoxEx.Show("此操作将永久删除选定信息。\n若要继续,请单击“确定”。", "您确认要删除此条信息吗?", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Warning);
                    if (result == DialogResult.OK)
                    {
                        var dataView = GetSelectedRowData();
                        var listField = GetCheckRows();
                        if (dataView != null && listField.Count > 0)
                        {
                            var selectedData = dataView[0];
                            var id = CommonCtrl.IsNullToString(selectedData["vip_id"]);
                            var flag = DBHelper.DeleteDataByID("删除客户回访信息", "tb_CustomerSer_Member", "vip_id",
                                id);
                            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();
        }
 /// <summary>
 /// 结算单位选择器事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtBalanceCompany_ChooserClick(object sender, EventArgs e)
 {
     frmCustomerInfo frmCInfo = new frmCustomerInfo();
     DialogResult result = frmCInfo.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtBalanceCompany.Text = frmCInfo.strCustomerName;
         txtBalanceCompany.Tag = frmCInfo.strCustomerId;
     }
 }
예제 #19
0
 /// <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;
     }
 }
예제 #20
0
        //初始化
        private void Init()
        {

            #region 初始化下拉框数据绑定
            CommonCtrl.BindComboBoxByDictionarr(cbo_member_grade, "sys_member_grade", false);    //绑定会员等级
            #endregion

            #region 初始化界面控件值

            if (windowStatus == 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().AddDays(1);
            }
            if (windowStatus == WindowStatus.Edit)
            {
                UIAssistants.SetUCBaseFuncationVisible(this, new ObservableCollection<ButtonEx_sms>
                {
                    btnSave, btnCancel, btnExport,btnSet, btnView,btnPrint
                });
                rtx_remark.Text = SelectedRow["remark"].ToString();
                SetCustInfo();
                if (!String.IsNullOrEmpty(VipId))
                    SetMemberInfo();
            }
            if (windowStatus == 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

            CancelEvent += (sender, args) => deleteMenuByTag(Tag.ToString(), UCMemberManager.Name);
            #region 保存数据
            SaveEvent += delegate
            {
                var check = CheckValue();
                if (!check) return;
                var dicFileds = new Dictionary<String, String>();
                var dicField4Cust = new Dictionary<String, String>();

                if (windowStatus == 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 (windowStatus == 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 (windowStatus == 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
        }
예제 #21
0
        //初始化
        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 (OpType == WindowStatus.Edit || OpType == WindowStatus.View)
            {
                SetCustInfo();
                SetContInfo();
                SetCallbackInfo();
            }
            if (OpType == 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

            #region 保存数据
            SaveEvent += delegate
            {
                var check = CheckValue();
                if (!check) return;
                var dicFileds = new Dictionary<String, String>();
                if (OpType == 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 (OpType == 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();
                    deleteMenuByTag(Tag.ToString(), UCCallBackManager.Name);
                }
            };
            #endregion
            #endregion
        }
예제 #22
0
        private void txtcust_name_ChooserClick(object sender, EventArgs e)
        {
            frmCustomerInfo chooseSupplier = new frmCustomerInfo();
            chooseSupplier.ShowDialog();
            string customerid=chooseSupplier.strCustomerId;
            if (!string.IsNullOrEmpty(customerid))
            {
                cust_code = chooseSupplier.strCustomerNo;
                txtcust_name.Text = chooseSupplier.strCustomerName;
                txtbalance_unit.Text = chooseSupplier.strCustomerName;

                DataTable dt = DBHelper.GetTable("查询客户档案信息", "tb_customer", "*", " enable_flag != 0 and cust_id='" + customerid + "'", "", "");
                if (dt.Rows.Count > 0)
                {
                    txtfax.Caption = dt.Rows[0]["cust_fax"].ToString();
                    txtcontacts_tel.Caption = dt.Rows[0]["cust_tel"].ToString();
                }
                string TableName = string.Format(@"(
                                                    select cont_name from tb_contacts where cont_id=
                                                    (select cont_id from tr_base_contacts where relation_object_id='{0}' and is_default='1')
                                                    ) tb_conts", customerid);
                DataTable dt_conts = DBHelper.GetTable("查询客户默认的联系人信息", TableName, "*", "", "", "");
                if (dt_conts != null && dt_conts.Rows.Count > 0)
                {
                    txtcontacts.Caption = dt_conts.Rows[0]["cont_name"].ToString();
                }
                else
                { txtcontacts.Caption = string.Empty; }

                //当客户id不为空,同时变更客户id时,需清空配件信息列表
                if (cust_id != string.Empty && cust_id != chooseSupplier.strCustomerId)
                {
                    if (gvPurchaseList.Rows.Count > 0)
                    {
                        int PurchaseListRows = gvPurchaseList.Rows.Count;
                        for (int i = 0; i < PurchaseListRows; i++)
                        {
                            DeleteListInfoEidtImportStatus(i);
                            i = -1;
                            PurchaseListRows = gvPurchaseList.Rows.Count;
                        }
                    }
                }
                cust_id = chooseSupplier.strCustomerId;
            }
        }
예제 #23
0
        //初始化
        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();
        }
예제 #24
0
 //往来单位选择
 private void txtcCustName_ChooserClick(object sender, EventArgs e)
 {
     //应收选择客户
     if (orderType == DataSources.EnumOrderType.RECEIVABLE)
     {
         frmCustomerInfo frm = new frmCustomerInfo();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             txtcCustName.Text = frm.strCustomerName;
             txtcCustName.Tag = frm.strCustomerId;
             cust_code = frm.strCustomerNo;
             //字动带出账户信息
             DataTable dt = DBHelper.GetTable("", "tb_customer", "*", string.Format("cust_id='{0}'", frm.strCustomerId), "", "");
             if (dt == null || dt.Rows.Count == 0)
             {
                 return;
             }
             txtBankAccount.Caption = CommonCtrl.IsNullToString(dt.Rows[0]["bank_account"]);
             txtBankOfDeposit.Caption = CommonCtrl.IsNullToString(dt.Rows[0]["open_bank"]);
             epError.Clear();
             txtAdvance.Caption = DBOperation.GetAdvance(frm.strCustomerId, orderType).ToString();
             txtBalance.Caption = DBOperation.GetReceivable(frm.strCustomerId).ToString();
         }
     }
     else if (orderType == DataSources.EnumOrderType.PAYMENT)//应付选择供应商
     {
         frmSupplier frmSupp = new frmSupplier();
         if (frmSupp.ShowDialog() == DialogResult.OK)
         {
             txtcCustName.Text = frmSupp.supperName;
             txtcCustName.Tag = frmSupp.supperID;
             cust_code = frmSupp.supperCode;
             epError.Clear();
             txtAdvance.Caption = DBOperation.GetAdvance(frmSupp.supperID, orderType).ToString();
             txtBalance.Caption = DBOperation.GetPayable(frmSupp.supperID).ToString();
         }
     }
 }
 /// <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 txtBalanceCompany_ChooserClick(object sender, EventArgs e)
 {
     try
     {
         frmCustomerInfo frmCInfo = new frmCustomerInfo();
         DialogResult result = frmCInfo.ShowDialog();
         if (result == DialogResult.OK)
         {
             txtBalanceCompany.Text = frmCInfo.strCustomerName;
             txtBalanceCompany.Tag = frmCInfo.strCustomerId;
         }
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
예제 #27
0
 private void txtbalance_unit_ChooserClick(object sender, EventArgs e)
 {
     frmCustomerInfo chooseSupplier = new frmCustomerInfo();
     chooseSupplier.ShowDialog();
     if (!string.IsNullOrEmpty(chooseSupplier.strCustomerId))
     {
         balance_unit = chooseSupplier.strCustomerId;
         txtbalance_unit.Text = chooseSupplier.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;
     }
 }
예제 #29
0
 /// <summary>
 /// 客户编码选择器事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtCustomNO_ChooserClick(object sender, EventArgs e)
 {
     frmCustomerInfo frmCInfo = new frmCustomerInfo();
     DialogResult result = frmCInfo.ShowDialog();
     if (result == DialogResult.OK)
     {
         txtCustomNO.Text = frmCInfo.strCustomerNo;
         txtCustomNO.Tag = frmCInfo.strCustomerId;
         txtCustomName.Caption = frmCInfo.strCustomerName;
     }
 }
        /// <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();
                }
            }
        }