/// <summary> /// 停用 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmDisable_Click(object sender, EventArgs e) { //获取选中的整行数据 Model_Customer editCustomer = dataGridView1.SelectedRows[0].Tag as Model_Customer; editCustomer.Activedk__BackingField = Enum_Active.Disable; try { ResultModelOfModel_Customerd4FqxSXX customer = cs.EditCustomer(editCustomer); if (customer.Code != 0) { MessageBox.Show(customer.Message); } else { MessageBox.Show("操作成功"); //customerLoad(); AvGue(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_Click(object sender, EventArgs e) { try { //引用交互接口 ConsoleServerWebReference.ConsoleServer cs = new ConsoleServerWebReference.ConsoleServer(); if (txtUserName.Text.Trim() == string.Empty) { MessageBox.Show("用户名不能为空"); } else { if (txtPassWord.Text.Trim() == string.Empty) { MessageBox.Show("密码不能为空"); } else { ResultModelOfModel_Customerd4FqxSXX aa = cs.Login(txtUserName.Text.Trim(), txtPassWord.Text.Trim()); if (aa.Code != 0) { MessageBox.Show(aa.Message); } else { txtPassWord.Text = string.Empty; this.Hide();//隐藏窗体 MainForm query = new MainForm(); query.UserName = txtUserName.Text; if (query.ShowDialog() == DialogResult.Cancel) { //this.Show(); this.Close(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <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); } }