Beispiel #1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text == UserModel.PassWord)
     {
         if (TextBox2.Text == "" || TextBox3.Text == "")
         {
             Maticsoft.Common.MessageBox.Show(this, "新密码不能为空!");
         }
         else if (TextBox2.Text != TextBox3.Text)
         {
             Maticsoft.Common.MessageBox.Show(this, "两次密码不一致!");
         }
         else
         {
             UserModel.PassWord = TextBox2.Text;
             BLL.Employee bl_emp = new BLL.Employee();
             bl_emp.Update(UserModel);
             Maticsoft.Common.MessageBox.Show(this, "密码修改成功!");
         }
     }
     else
     {
         Maticsoft.Common.MessageBox.Show(this, "旧密码不对!");
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataSet ds = new BLL.Employee().GetAllList();
         Repeater1.DataSource = ds;
         Repeater1.DataBind();
         foreach (RepeaterItem item in Repeater1.Items)
         {
             Label    UserId    = (Label)item.FindControl("Label2");
             DataSet  UserRight = new BLL.UserRight().GetListByUserId(Convert.ToInt32(UserId.Text));
             CheckBox CB1       = (CheckBox)item.FindControl("CheckBox1");
             CheckBox CB2       = (CheckBox)item.FindControl("CheckBox2");
             CheckBox CB3       = (CheckBox)item.FindControl("CheckBox3");
             CheckBox CB4       = (CheckBox)item.FindControl("CheckBox4");
             CheckBox CB5       = (CheckBox)item.FindControl("CheckBox5");
             CheckBox CB6       = (CheckBox)item.FindControl("CheckBox6");
             CheckBox CB7       = (CheckBox)item.FindControl("CheckBox7");
             CheckBox CB8       = (CheckBox)item.FindControl("CheckBox8");
             CheckBox CB9       = (CheckBox)item.FindControl("CheckBox9");
             CheckBox CB10      = (CheckBox)item.FindControl("CheckBox10");
             CB1.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB1.Text));
             CB2.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB2.Text));
             CB3.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB3.Text));
             CB4.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB4.Text));
             CB5.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB5.Text));
             CB6.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB6.Text));
             CB7.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB7.Text));
             CB8.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB8.Text));
             CB9.Checked  = CheckHaveRight(UserRight, Convert.ToInt32(CB9.Text));
             CB10.Checked = CheckHaveRight(UserRight, Convert.ToInt32(CB10.Text));
         }
     }
 }
Beispiel #3
0
        public void DataBind()//定义一个函数用于绑定数据到DataGridView
        {
            BLL.Employee bll = new BLL.Employee();
            DataSet      ds  = new DataSet();

            ds = bll.GetList();                      //执行SQL语句,将结果存在ds中
            dataGridView1.DataSource = ds.Tables[0]; //将ds中的表作为DataGridView的数据源
        }
Beispiel #4
0
        private void txtOK_Click(object sender, EventArgs e)
        {
            string strSelect = this.cbxCondition.Text.Trim();

            if (strSelect == "")
            {
                MessageBox.Show("请选择查询条件!");
                return;
            }
            if (this.txtKeyWord.Text == "")
            {
                MessageBox.Show("输入查询条件!");
                return;
            }
            string strWhere           = "1=1";
            string employeeName       = txtKeyWord.Text;
            string sex                = txtKeyWord.Text;
            string employeeDepartment = txtKeyWord.Text;
            string employeePost       = txtKeyWord.Text;

            switch (strSelect)
            {
            case "员工姓名":
            {
                strWhere = strWhere + " and EmployeeName like '%" + employeeName + "%'";
            }
            break;

            case "员工性别":
            {
                strWhere = strWhere + " and Sex = '" + sex + "'";
            }
            break;

            case "所属部门":
            {
                strWhere = strWhere + " and EmployeeDepartment like '" + employeeDepartment + "'";
            }
            break;

            case "员工职位":
            {
                strWhere = strWhere + " and EmployeePost like '" + employeePost + "'";
            }
            break;
            }
            BLL.Employee bll = new BLL.Employee(); //实例化BLL层
            DataSet      ds  = new DataSet();

            ds = bll.GetList(strWhere);              //执行带参数SQL语句,将结果存在ds中
            dataGridView1.DataSource = ds.Tables[0]; //将ds中的表作为DataGridView的数据源
        }
Beispiel #5
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            if (txtEmployeeID.Text == "" || txtEmployeeName.Text == "" || txtEmail.Text == "" || txtEmployeeAddress.Text == "" || txtPhone.Text == "")
            {
                MessageBox.Show("请将信息添加完整!");
                return;
            }
            Model.EmployeeInfo model = new Model.EmployeeInfo();//实例化model层
            model.EmployeeID         = txtEmployeeID.Text.Trim();
            model.EmployeeName       = txtEmployeeName.Text.Trim();
            model.Sex                = cboSex.Text.Trim();
            model.EmployeeBirthday   = DateTime.Parse(dateTimePicker1.Text);
            model.EmployeeDepartment = cmbEmployeeDepartment.Text;
            model.EmployeePost       = cmbEmployeePost.Text;
            model.EmployeePhone      = txtPhone.Text.Trim();
            model.EmployeeEmail      = txtEmail.Text;
            model.EmployeeAddress    = txtEmployeeAddress.Text;
            BLL.Employee bll = new BLL.Employee();//实例化BLL层
            switch (flag)
            {
            case 0: {
            } break;

            case 1:  {
                if (bll.Add(model))        //将员工信息添加到数据库中,根据返回值判断是否添加成功
                {
                    DataBind();            //窗体登录时绑定数据到DataGridView
                    ControlStatus();
                }
            } break;

            case 2: {
                if (bll.Update(model))     //根据返回布尔值判断是否修改数据成功
                {
                    DataBind();            //窗体登录时绑定数据到DataGridView
                    ControlStatus();
                }
            } break;

            case 3: {
                if (bll.Delete(model))     //根据返回布尔值判断是否删除数据成功
                {
                    DataBind();            //窗体登录时绑定数据到DataGridView
                    ControlStatus();
                }
            } break;
            }
        }
Beispiel #6
0
        /// <summary>
        /// 获取员工表中的  员工编号
        /// </summary>
        private void ObtionEmployeeID()
        {
            BLL.Employee bll = new BLL.Employee();
            DataSet      ds  = new DataSet();

            ds = bll.GetList();//执行SQL语句,将结果存在ds中
            if (ds.Tables[0].Rows.Count > 0)
            {
                string[] array = new string[ds.Tables[0].Rows.Count];
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    array[i] = ds.Tables[0].Rows[i]["员工编号"].ToString();
                    cboEmpID.Items.Add(array[i]);
                }
            }
        }
        private void Employee_Load(object sender, EventArgs e)
        {
            DataBind();//窗体登录时绑定数据到DataGridView
            BLL.Employee bll = new BLL.Employee();
            DataSet      ds  = new DataSet();

            ds = bll.GetList();//执行SQL语句,将结果存在ds中
            if (ds.Tables[0].Rows.Count > 0)
            {
                string[] array = new string[ds.Tables[0].Rows.Count];
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    array[i] = ds.Tables[0].Rows[i]["员工编号"].ToString();
                    cboEmpID.Items.Add(array[i]);
                }
            }
        }
Beispiel #8
0
 public EmployeePresenter(IEmployeeView view) : base(view)
 {
     this.Mode = new BLL.Employee();
 }
        private void OnEmployeeBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
        {
            _currentEmployee = uxEmployeeBindingSource.Current as BLL.Employee;

            if (_currentEmployee != null)
            {
                _currentEmployee.Validate();
            }
            //_Employee.Validate();
            OnCurrentEntityChanged();
        }