Exemplo n.º 1
0
        private void btnEdit_Dept_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                FrmSetDept frm = new FrmSetDept(strUserID);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    strDeptID   = frm.strDeptID;
                    strDeptName = frm.strDeptName;

                    btnEdit_Dept.Text = frm.strDeptName;

                    frm.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow dr = gv_User.GetDataRow(gv_User.FocusedRowHandle);

                if (dr != null)
                {
                    if (UserInfo.userID == dr["用户名"].ToString() && UserInfo.userID != "system")
                    {
                        MessageBox.Show("自己不能修改自己部门!");
                        return;
                    }

                    FrmSetDept frm = new FrmSetDept(dr["用户名"].ToString());
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        ModTS_USER_DEPT model = bllTsUserDept.Get_Model(dr["用户名"].ToString());
                        if (model != null)
                        {
                            model.C_DEPT_ID = frm.strDeptID;
                            bllTsUserDept.Update(model);
                        }
                        else
                        {
                            model           = new ModTS_USER_DEPT();
                            model.C_DEPT_ID = frm.strDeptID;
                            model.C_USER_ID = dr["用户名"].ToString();

                            bllTsUserDept.Add(model);
                        }

                        BindList();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }