示例#1
0
        /// <summary>
        /// 修改惊尘管理员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnQueDing_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCustomerFullName.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("客户全称不能为空");
                    return;
                }
                if (Encoding.Default.GetBytes(txtCustomerFullName.Text.Trim()).Length > 100)
                {
                    MessageBox.Show("客户全称不能超过100");
                    return;
                }
                if (txtCustomerAccount.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("客户账号不能为空");
                    return;
                }
                if (Encoding.Default.GetBytes(txtCustomerAccount.Text.Trim()).Length > 50)
                {
                    MessageBox.Show("客户账号不能超过50");
                    return;
                }
                if (txtContacts.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("联系人不能为空");
                    return;
                }
                if (Encoding.Default.GetBytes(txtContacts.Text.Trim()).Length > 50)
                {
                    MessageBox.Show("联系人不能超过50");
                    return;
                }
                if (txtContactNumber.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("联系电话不能为空");
                    return;
                }
                if (Encoding.Default.GetBytes(txtContactNumber.Text.Trim()).Length > 50)
                {
                    MessageBox.Show("联系电话不能超过50");
                    return;
                }
                if (!IsTelephone(txtContactNumber.Text.Trim()))
                {
                    MessageBox.Show("你输入的不是手机/电话号码!");
                    return;
                }
                if (cmbProvince.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("省份不能为空");
                    return;
                }
                if (cmbProvince.Text.Trim() == "中国")
                {
                    MessageBox.Show("请选择省份");
                    return;
                }
                if (cmbCity.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("城市不能为空");
                    return;
                }
                if (cmbCity.Text.Trim() == "中国")
                {
                    MessageBox.Show("请选择城市");
                    return;
                }
                if (cmbCounty.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("县城不能为空");
                    return;
                }
                if (cmbCounty.Text.Trim() == "中国")
                {
                    MessageBox.Show("请选择县城");
                    return;
                }
                if (txtContactAddress.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("联系地址不能为空");
                    return;
                }
                if (Encoding.Default.GetBytes(txtContactAddress.Text.Trim()).Length > 200)
                {
                    MessageBox.Show("联系地址不能超过200");
                    return;
                }
                if (Encoding.Default.GetBytes(txtRemarks.Text.Trim()).Length > 200)
                {
                    MessageBox.Show("备注不能超过200");
                    return;
                }

                Model_Customer customer = new Model_Customer();
                customer.Idk__BackingField             = cus.Idk__BackingField;
                customer.FullNamek__BackingField       = txtCustomerFullName.Text;
                customer.ContactPersonk__BackingField  = txtContacts.Text;
                customer.ContactTelk__BackingField     = txtContactNumber.Text;
                customer.ContactAddressk__BackingField = txtContactAddress.Text;
                customer.ProvinceIdk__BackingField     = Convert.ToInt32(cmbProvince.SelectedValue);
                customer.ProvinceNamek__BackingField   = cmbProvince.Text;
                customer.CityIdk__BackingField         = Convert.ToInt32(cmbCity.SelectedValue);
                customer.CityNamek__BackingField       = cmbCity.Text;
                customer.CountyIdk__BackingField       = Convert.ToInt32(cmbCounty.SelectedValue);
                customer.CountyNamek__BackingField     = cmbCounty.Text;
                customer.Accountk__BackingField        = txtCustomerAccount.Text;
                customer.Rolek__BackingField           = cus.Rolek__BackingField;
                customer.Activedk__BackingField        = cus.Activedk__BackingField;
                customer.CreateAtk__BackingField       = cus.CreateAtk__BackingField;
                customer.Remarkk__BackingField         = txtRemarks.Text;

                //ResultModelOfModel_Customerd4FqxSXX save = cs.EditCustomer(customer);
                //ResultModelOfModel_Customerd4FqxSXX save = cs.GetCustomerCounty(customer);
                ResultModelOfModel_Customerd4FqxSXX save = cs.GetCustomerUpdateTime(customer);
                if (save.Code != 0)
                {
                    MessageBox.Show(save.Message);
                }
                else
                {
                    MessageBox.Show("操作成功");
                    getCustomerLoad();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }