private void grd_editRole_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; int roleId = 0; BLL.clsUserRoleData roledata = new BLL.clsUserRoleData(); try { //check for do action if (COMM_METHODS.checkActPermission(this.Name, USERNAME)) { if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { roleId = Convert.ToInt16(senderGrid.SelectedCells[e.ColumnIndex - 1].Value); roledata = MANAGEDB.getSingleRoleData(roleId); FrmAddUserRole addRole = new FrmAddUserRole(roledata, USERNAME); addRole.WindowState = FormWindowState.Normal; addRole.ShowDialog(); grd_editRole.DataSource = MANAGEDB.getUserRoleDetails(); } } else { COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!"); } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
public FrmAddUserRole(BLL.clsUserRoleData roleData, string userName) { COM_MESSAGE = new CommonControls.Classes.ClsMessages(); VALIDATION = new CommonControls.Classes.ClsValidation(); COMM_METHODS = new CommonControls.Classes.ClsCommonMethods(); MANAGEDB = new BLL.ClsUserManageDbChanges(); USERNAME = userName; InitializeComponent(); txt_userRoleID.Text = roleData._roleId.ToString(); txt_userRole.Text = roleData._roleName; IS_UPDATING = true; btn_update.Visible = true; btn_add.Visible = false; this.StartPosition = FormStartPosition.CenterScreen; this.ActiveControl = txt_userRole; }