private void ultraButton3_Click(object sender, System.EventArgs e) { //删除部门 try { Dept dept = new Dept(); dept.cnnDeptID = int.Parse(txtDeptName3.Tag.ToString()); dept.cnvcDeptName = txtDeptName3.Text; if (cmbParentDept3.Items.Count > 0) { if (cmbParentDept3.SelectedIndex >= 0) { dept.cnnParentDeptID = int.Parse(cmbParentDept3.SelectedItem.DataValue.ToString()); } } dept.cnnDiscount = int.Parse(txtDiscount3.Text); dept.cnvcManager = cmbManager3.Text; SecurityManage secruty = new SecurityManage(); secruty.DeleteDept(dept); MessageBox.Show(this, "部门删除成功!", "部门管理", MessageBoxButtons.OK, MessageBoxIcon.Information); BindParentDept(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BindOper() { try { SecurityManage secruty = new SecurityManage(); DataTable dtOper = secruty.getAllOper(); cmbManager.DataSource = dtOper; cmbManager.ValueMember = "操作员ID"; cmbManager.DisplayMember = "操作员名称"; cmbManager.DataBind(); cmbManager3.DataSource = dtOper; cmbManager3.ValueMember = "操作员ID"; cmbManager3.DisplayMember = "操作员名称"; cmbManager3.DataBind(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ultraButton1_Click(object sender, System.EventArgs e) { try { Dept dept = new Dept(); dept.cnvcDeptName = txtDeptName2.Text; if (cmbParentDept2.Items.Count > 0) { if (cmbParentDept2.SelectedIndex >= 0) { dept.cnnParentDeptID = int.Parse(cmbParentDept2.SelectedItem.DataValue.ToString()); } } SecurityManage secruty = new SecurityManage(); DataTable dtDept = secruty.getDept(dept); this.ultraGrid1.DataSource = dtDept; this.ultraGrid1.DataBind(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ultraButton3_Click(object sender, System.EventArgs e) { //删除 try { Oper opers = new Oper(); opers.cnnOperID = int.Parse(txtOperName3.Tag.ToString()); opers.cnvcOperName = txtOperName.Text; if (cmbDept3.Items.Count > 0) { if (cmbDept3.SelectedIndex >= 0) { opers.cnnDeptID = int.Parse(cmbDept3.SelectedItem.DataValue.ToString()); } } SecurityManage secruty = new SecurityManage(); secruty.DeleteOper(opers); MessageBox.Show(this, "操作员修改成功!", "操作员管理", MessageBoxButtons.OK, MessageBoxIcon.Information); BindDept(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BindParentDept() { SecurityManage secruty = new SecurityManage(); DataTable dtDept = secruty.getAllDept(); cmbParentDept.DataSource = dtDept; cmbParentDept.ValueMember = "部门ID"; cmbParentDept.DisplayMember = "部门名称"; cmbParentDept.DataBind(); cmbParentDept.SelectedIndex = 0; //cmbParentDept.FindString("云南人才市场"); cmbParentDept2.DataSource = dtDept; cmbParentDept2.ValueMember = "部门ID"; cmbParentDept2.DisplayMember = "部门名称"; cmbParentDept2.DataBind(); cmbParentDept2.SelectedIndex = 0; //cmbParentDept2.FindString("云南人才市场"); cmbParentDept3.DataSource = dtDept; cmbParentDept3.ValueMember = "部门ID"; cmbParentDept3.DisplayMember = "部门名称"; cmbParentDept3.DataBind(); cmbParentDept3.SelectedIndex = 0; //cmbParentDept3.FindString("云南人才市场"); this.ultraGrid1.DataSource = dtDept; this.ultraGrid1.DataBind(); BindOper(); }
private void BindDept() { SecurityManage secruty = new SecurityManage(); DataTable dtDept = secruty.getAllDept(); cmbDept.DataSource = dtDept; cmbDept.ValueMember = "部门ID"; cmbDept.DisplayMember = "部门名称"; cmbDept.DataBind(); cmbDept.SelectedIndex = 0; cmbDept2.DataSource = dtDept; cmbDept2.ValueMember = "部门ID"; cmbDept2.DisplayMember = "部门名称"; cmbDept2.DataBind(); cmbDept2.SelectedIndex = 0; cmbDept3.DataSource = dtDept; cmbDept3.ValueMember = "部门ID"; cmbDept3.DisplayMember = "部门名称"; cmbDept3.DataBind(); cmbDept3.SelectedIndex = 0; BindOper(); }
private void btnAddOper_Click(object sender, System.EventArgs e) { try { if (txtOperName.Text == "admin") { throw new BusinessException("操作员管理", "操作员添加错误!"); } Oper opers = new Oper(); opers.cnvcOperName = txtOperName.Text; opers.cnvcPwd = DataSecurity.Encrypt(txtPwd.Text); opers.cnnDeptID = int.Parse(cmbDept.SelectedItem.DataValue.ToString()); SecurityManage security = new SecurityManage(); security.AddOper(opers); MessageBox.Show(this, "操作员添加成功!", "操作员管理", MessageBoxButtons.OK, MessageBoxIcon.Information); BindDept(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnModifyOper_Click(object sender, System.EventArgs e) { //修改业务员 try { if (txtOperName.Text.Trim().Length == 0) { throw new BusinessException("业务员", "业务员名称不能为空!"); } if (cmbDept.Value == null) { throw new BusinessException("业务员", "请选择要添加业务员的部门!"); } Sales oldSales = txtOperName.Tag as Sales; if (!oldSales.cnvcSales.Equals(txtOperName.Text)) { DataTable dtOper = Helper.Query("select * from tbSales where cnvcSales = '" + txtOperName.Text + "'"); if (dtOper.Rows.Count > 0) { throw new BusinessException("业务员", "同名业务员已存在,不能修改!"); } } Sales opers = new Sales(); opers.cnnSales = oldSales.cnnSales; opers.cnvcSales = txtOperName.Text; opers.cnvcTel = txtTel.Text; opers.cnvcCredentials = txtCredentials.Text; opers.cnnDeptID = Convert.ToInt32(cmbDept.Value); SecurityManage security = new SecurityManage(); security.ModifySales(opers); MessageBox.Show(this, "业务员修改成功!", "业务员管理", MessageBoxButtons.OK, MessageBoxIcon.Information); BindTree(); //BindDept(); gbOper.Visible = false; } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BindOper() { try { SecurityManage secruty = new SecurityManage(); DataTable dtOpers = secruty.getAllOper(); this.ultraGrid1.DataSource = dtOpers; this.ultraGrid1.DataBind(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnQueryOper_Click(object sender, System.EventArgs e) { //查询 try { Oper opers = new Oper(); opers.cnvcOperName = txtOperName2.Text; opers.cnvcPwd = cmbDept2.Text; SecurityManage secruty = new SecurityManage(); DataTable dtOpers = secruty.getOper(opers); this.ultraGrid1.DataSource = dtOpers; this.ultraGrid1.DataBind(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDeleteOper_Click(object sender, System.EventArgs e) { //删除业务员 try { Sales oldSales = txtOperName.Tag as Sales; SecurityManage securityManage = new SecurityManage(); securityManage.DeleteSales(oldSales); MessageBox.Show(this, "业务员删除成功!", "业务员管理", MessageBoxButtons.OK, MessageBoxIcon.Information); BindTree(); //BindDept(); gbOper.Visible = false; } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BillRepeat_Load(object sender, System.EventArgs e) { //初始化操作员 SecurityManage security = new SecurityManage(); DataTable dtOper = security.getOpers(); cmbOperName.DataSource = dtOper; cmbOperName.DisplayMember = "cnvcOperName"; cmbOperName.ValueMember = "cnnOperID"; cmbOperName.DataBind(); cmbBillType.Items.Add(ConstApp.Bill_Type_AddPrepay); cmbBillType.Items.Add(ConstApp.Bill_Type_InMoney); cmbBillType.Items.Add(ConstApp.Bill_Type_Provide); cmbBillType.Items.Add(ConstApp.Bill_Type_SignIn); cmbBillType.Items.Add("预订"); this.cmbBeginDate.MaskInput = "yyyy-mm-dd hh:mm"; cmbEndDate.MaskInput = "yyyy-mm-dd hh:mm"; this.cmbBeginDate.Value = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00"; cmbEndDate.Value = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59"; //cmbOperName.Items.Add("%","*"); }