public void ControlEnableDisable(bool trb, bool fld) { BtnNew.Enabled = trb; BtnEdit.Enabled = trb; BtnDelete.Enabled = trb; BtnExit.Enabled = trb; if (BtnNew.Enabled == true) { BtnNew.Focus(); } BtnSearchGroup.Enabled = fld; TxtGroup.Enabled = fld; Utility.EnableDesibleColor(TxtGroup, fld); tabControl1.Enabled = fld; BtnSave.Enabled = fld; BtnCancel.Enabled = fld; if (BtnNew.Enabled == true) { BtnNew.Focus(); } else if (TxtGroup.Enabled == true) { TxtGroup.Focus(); } }
private void BtnDelete_Click(object sender, EventArgs e) { _Tag = "DELETE"; ControlEnableDisable(false, false); Text = "Menu Permission Group [DELETE]"; TxtGroup.Enabled = true; BtnSearchGroup.Enabled = true; TxtGroup.Focus(); BtnSave.Enabled = true; BtnCancel.Enabled = true; }
private void BtnSearchGroup_Click(object sender, EventArgs e) { Common.PickList frmPickList = new Common.PickList("MenuPermissionGroup", _SearchKey); if (Common.PickList.dt.Rows.Count > 0) { frmPickList.ShowDialog(); if (frmPickList.SelectedList.Count > 0 && _Tag != "NEW") { TxtGroup.Text = frmPickList.SelectedList[0]["PremissionGroupName"].ToString().Trim(); DataTable dt = _objmennupermission.GetMenuPermissionByName(frmPickList.SelectedList[0]["PremissionGroupName"].ToString().Trim()); DataRow[] result1 = dt.Select("Module='Company'"); int i = 0; foreach (DataRow row in result1) { GridCompany.Rows[i].Cells[5].Value = Convert.ToInt32(row["Access"].ToString()) == 0 ? false : true; i++; } DataRow[] result2 = dt.Select("Module='Master'"); i = 0; foreach (DataRow row in result2) { GridMaster.Rows[i].Cells[5].Value = Convert.ToInt32(row["Access"].ToString()) == 0 ? false : true; i++; } DataRow[] result3 = dt.Select("Module='Transaction'"); i = 0; foreach (DataRow row in result3) { GridTransaction.Rows[i].Cells[5].Value = Convert.ToInt32(row["Access"].ToString()) == 0 ? false : true; i++; } TxtGroup.SelectAll(); } frmPickList.Dispose(); } else { MessageBox.Show("No List Available in Menu Permission Group !", "Mr. Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtGroup.Focus(); return; } TxtGroup.Focus(); }
private void ClearFld() { foreach (DataGridViewRow ro in GridCompany.Rows) { ro.Cells["Access"].Value = false; } foreach (DataGridViewRow ro in GridMaster.Rows) { ro.Cells["MasterAccess"].Value = false; } foreach (DataGridViewRow ro in GridTransaction.Rows) { ro.Cells["TransactionAccess"].Value = false; } TxtGroup.Text = ""; TxtGroup.Focus(); }
private void TxtGroup_KeyDown(object sender, KeyEventArgs e) { if (_objmennupermission.CheckDuplicate(TxtGroup.Text.Trim(), _Tag) > 0) { MessageBox.Show("Group Name Already Exists", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtGroup.Focus(); return; } if (_Tag == "NEW" && (e.KeyCode.ToString() == "" || e.KeyCode.ToString() == "F1")) { _SearchKey = string.Empty; BtnSearchGroup.PerformClick(); } else { _SearchKey = e.KeyCode.ToString() == "Escape" ? "" : e.KeyCode.ToString(); ClsGlobal.MyKeyDown((char)e.KeyCode, e.KeyValue, e.KeyData.ToString(), _Tag, _SearchKey, TxtGroup, BtnSearchGroup, true); } }
private void BtnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtGroup.Text)) { MessageBox.Show("Please Enter Group Name.", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtGroup.Focus(); return; } DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel _model = null; if (_Tag != "DELETE") { foreach (DataGridViewRow ro in GridCompany.Rows) { _model = new DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel(); // _model.ID = Convert.ToInt32(ro.Cells["ID"].Value.ToString()); _model.MainForm = ro.Cells["MainForm"].Value.ToString(); _model.FormName = ro.Cells["FormName"].Value.ToString(); _model.DisplayName = ro.Cells["DisplayName"].Value.ToString(); _model.Odr = Convert.ToInt32(ro.Cells["Order"].Value.ToString()); _model.Access = Convert.ToBoolean(ro.Cells["Access"].Value) == true ? 1 : 0; _model.MenuId = ro.Cells["MenuId"].Value.ToString(); _model.Module = ro.Cells["Module"].Value.ToString(); _model.PremissionGroupName = TxtGroup.Text; _objmennupermission.Model.Add(_model); } foreach (DataGridViewRow ro in GridMaster.Rows) { _model = new DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel(); // _model.ID = Convert.ToInt32(ro.Cells["MasterId"].Value.ToString()); _model.MainForm = ro.Cells["MasterMainForm"].Value.ToString(); _model.FormName = ro.Cells["MasterFormName"].Value.ToString(); _model.DisplayName = ro.Cells["MasterDisplayName"].Value.ToString(); _model.Odr = Convert.ToInt32(ro.Cells["MasterOrder"].Value.ToString()); _model.Access = Convert.ToBoolean(ro.Cells["MasterAccess"].Value) == true ? 1 : 0; _model.MenuId = ro.Cells["MasterMenuId"].Value.ToString(); _model.Module = ro.Cells["MasterModule"].Value.ToString(); _model.PremissionGroupName = TxtGroup.Text; _objmennupermission.Model.Add(_model); } foreach (DataGridViewRow ro in GridTransaction.Rows) { _model = new DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel(); // _model.ID = Convert.ToInt32(ro.Cells["TransactionId"].Value.ToString()); _model.MainForm = ro.Cells["TransactionMainForm"].Value.ToString(); _model.FormName = ro.Cells["TransactionFormName"].Value.ToString(); _model.DisplayName = ro.Cells["TransactionDisplayName"].Value.ToString(); _model.Odr = Convert.ToInt32(ro.Cells["TransactionOrder"].Value.ToString()); _model.Access = Convert.ToBoolean(ro.Cells["TransactionAccess"].Value) == true ? 1 : 0; _model.MenuId = ro.Cells["TransactionMenuId"].Value.ToString(); _model.Module = ro.Cells["TransactionModule"].Value.ToString(); _model.PremissionGroupName = TxtGroup.Text; _objmennupermission.Model.Add(_model); } foreach (DataGridViewRow ro in GridFinance.Rows) { _model = new DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel(); // _model.ID = Convert.ToInt32(ro.Cells["FinanceId"].Value.ToString()); _model.MainForm = ro.Cells["FinanceMainForm"].Value.ToString(); _model.FormName = ro.Cells["FinanceFormName"].Value.ToString(); _model.DisplayName = ro.Cells["FinanceDisplayName"].Value.ToString(); _model.Odr = Convert.ToInt32(ro.Cells["FinanceOrder"].Value.ToString()); _model.Access = Convert.ToBoolean(ro.Cells["FinanceAccess"].Value) == true ? 1 : 0; _model.MenuId = ro.Cells["FinanceMenuId"].Value.ToString(); _model.Module = ro.Cells["FinanceModule"].Value.ToString(); _model.PremissionGroupName = TxtGroup.Text; _objmennupermission.Model.Add(_model); } foreach (DataGridViewRow ro in GridARAP.Rows) { _model = new DataAccessLayer.SystemSetting.MenuPermissionGroupViewModel(); // _model.ID = Convert.ToInt32(ro.Cells["ARAPId"].Value.ToString()); _model.MainForm = ro.Cells["ARAPMainForm"].Value.ToString(); _model.FormName = ro.Cells["ARAPFormName"].Value.ToString(); _model.DisplayName = ro.Cells["ARAPDisplayName"].Value.ToString(); _model.Odr = Convert.ToInt32(ro.Cells["ARAPOrder"].Value.ToString()); _model.Access = Convert.ToBoolean(ro.Cells["ARAPAccess"].Value) == true ? 1 : 0; _model.MenuId = ro.Cells["ARAPMenuId"].Value.ToString(); _model.Module = ro.Cells["ARAPModule"].Value.ToString(); _model.PremissionGroupName = TxtGroup.Text; _objmennupermission.Model.Add(_model); } } _objmennupermission.SaveMenuPermission(TxtGroup.Text.Trim()); MessageBox.Show("Data has been updated successfully", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearFld(); }