private void frmAddEditModuleForm_Load(object sender, EventArgs e) { try { txtDisplayName.Text = txtFormName.Text = string.Empty; chkIsActive.Checked = true; cboModule.DataSource = (new ServiceModules()).GetAllActiveModules(); cboModule.DisplayMember = "Description"; cboModule.ValueMember = "ID"; if (ModuleID != 0) { cboModule.SelectedItem = ((List <SelectListItem>)cboModule.DataSource).Where(x => x.ID == this.ModuleID).FirstOrDefault(); } this.Text = "Module Feature [ADD NEW]"; if (this.FormID != 0) { Tbl_MP_Master_Module_Forms form = (new ServiceModules()).GetModuleFormDBRecordByID(this.FormID); if (form != null) { txtFormName.Text = form.FormName; txtDisplayName.Text = form.DisplayName; cboModule.SelectedItem = ((List <SelectListItem>)cboModule.DataSource).Where(x => x.ID == form.FK_ModuleId).FirstOrDefault(); chkIsActive.Checked = form.IsActive; } this.Text = "Module Feature [EDIT]"; } } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message); MessageBox.Show(errMessage, "frmAddEditModuleForm::frmAddEditModuleForm_Load", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmAddEditFormPermission_Load(object sender, EventArgs e) { try { SetPermissionButtonsTag(); if (RoleFormID != 0) { TBL_MP_Master_RoleForm model = (new ServiceRoles()).GetRoleModuleFormDBRecordByID(this.RoleFormID); if (model != null) { Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID((int)model.FK_ModuleId); if (dbModule != null) { lblModuleName.Text = dbModule.DisplayName.ToUpper(); } Tbl_MP_Master_Module_Forms dbModuleForm = (new ServiceModules()).GetModuleFormDBRecordByID((int)model.FK_FormId); if (dbModuleForm != null) { lblFormName.Text = dbModuleForm.DisplayName; } btnCanAddNewRecord.Checked = model.CanAddNew; PermissionsButton_Click(btnCanAddNewRecord, new EventArgs()); btnCanApproveRecord.Checked = model.CanApprove; PermissionsButton_Click(btnCanApproveRecord, new EventArgs()); btnCanAuthorizeRecord.Checked = model.CanAuthorize; PermissionsButton_Click(btnCanAuthorizeRecord, new EventArgs()); btnCanCheckRecord.Checked = model.CanCheck; PermissionsButton_Click(btnCanCheckRecord, new EventArgs()); btnCanDeleteRecord.Checked = model.CanDelete; PermissionsButton_Click(btnCanDeleteRecord, new EventArgs()); btnCanModifyRecord.Checked = model.CanModify; PermissionsButton_Click(btnCanModifyRecord, new EventArgs()); btnCanPrintRecord.Checked = model.CanPrint; PermissionsButton_Click(btnCanPrintRecord, new EventArgs()); btnCanViewRecord.Checked = model.CanView; PermissionsButton_Click(btnCanViewRecord, new EventArgs()); } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmAddEditFormPermission::frmAddEditFormPermission_Load", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; Tbl_MP_Master_Module_Forms form = null; try { errorProvider1.Clear(); if (this.ValidateChildren()) { if (this.FormID == 0) { form = new Tbl_MP_Master_Module_Forms() { FormName = txtFormName.Text.Trim(), DisplayName = txtDisplayName.Text.Trim(), FK_ModuleId = ((SelectListItem)(cboModule.SelectedItem)).ID, IsActive = chkIsActive.Checked }; this.FormID = (new ServiceModules()).AddNewModuleForm(form); if (this.FormID != 0) { this.DialogResult = DialogResult.OK; } } else { form = (new ServiceModules()).GetModuleFormDBRecordByID(this.FormID); if (form != null) { form.FormName = txtFormName.Text.Trim(); form.DisplayName = txtDisplayName.Text.Trim(); form.IsActive = chkIsActive.Checked; form.FK_ModuleId = ((SelectListItem)(cboModule.SelectedItem)).ID; bool res = (new ServiceModules()).UpdateModuleForm(form); if (res) { this.DialogResult = DialogResult.OK; } } } } } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message); MessageBox.Show(errMessage, "frmAddEditModuleForm::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Cursor = Cursors.Default; }
public Tbl_MP_Master_Module_Forms GetModuleFormDBRecordByID(int formID) { Tbl_MP_Master_Module_Forms form = null; try { form = _dbContext.Tbl_MP_Master_Module_Forms.Where(x => x.PK_FormId == formID).FirstOrDefault(); } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message); MessageBox.Show(errMessage, "ServiceModules::GetModuleDBRecordByID", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(form); }
private void gridForms_RowEnter(object sender, DataGridViewCellEventArgs e) { try { headerGroupDeleteForm.ValuesPrimary.Heading = string.Empty; txtDeleteFormInfo.Text = string.Empty; if (e.RowIndex >= 0) { SelectedFormID = (int)gridForms.Rows[e.RowIndex].Cells["ID"].Value; } bool isactive = (bool)gridForms.Rows[e.RowIndex].Cells["IsActive"].Value; if (isactive) { btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False; btnEditForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True; btnDeleteForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True; } else { btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True; btnEditForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False; btnDeleteForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False; } Tbl_MP_Master_Module_Forms dbModuleForm = (new ServiceModules()).GetModuleFormDBRecordByID(this.SelectedFormID); if (dbModuleForm != null) { if (dbModuleForm.DeletedBy != null) { string empName = ServiceEmployee.GetEmployeeNameByID((int)dbModuleForm.DeletedBy); headerGroupDeleteForm.ValuesPrimary.Heading = string.Format("Deleted by {0} dt. {1}", empName, dbModuleForm.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt")); } txtDeleteFormInfo.Text = dbModuleForm.DeleteRemarks; } } catch (Exception ex) { MessageBox.Show(ex.Message, "pageModules::gridForms_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool UndeleteModuleFormMasterInfo(int formID, string reason) { bool result = false; try { Tbl_MP_Master_Module_Forms editItem = _dbContext.Tbl_MP_Master_Module_Forms.Where(x => x.PK_FormId == formID).FirstOrDefault(); editItem.DeleteDatetime = null; editItem.DeletedBy = null; editItem.IsActive = true; editItem.DeleteRemarks = reason; _dbContext.SaveChanges(); result = true; } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message); MessageBox.Show(errMessage, "ServiceModules::UndeleteModuleFormMasterInfo", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public int AddNewModuleForm(Tbl_MP_Master_Module_Forms model) { int newID = 0; try { Tbl_MP_Master_Module_Forms newModuleForm = new Tbl_MP_Master_Module_Forms(); newModuleForm.FK_ModuleId = model.FK_ModuleId; newModuleForm.FormName = model.FormName; newModuleForm.DisplayName = model.DisplayName; newModuleForm.IsActive = model.IsActive; _dbContext.Tbl_MP_Master_Module_Forms.Add(newModuleForm); _dbContext.SaveChanges(); newID = newModuleForm.PK_FormId; } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.InnerException.Message); MessageBox.Show(errMessage, "ServiceModules::AddNewModuleForm", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(newID); }
public bool UpdateModuleForm(Tbl_MP_Master_Module_Forms model) { bool result = false; try { Tbl_MP_Master_Module_Forms newModule = _dbContext.Tbl_MP_Master_Module_Forms.Where(x => x.PK_FormId == model.PK_FormId).FirstOrDefault(); if (newModule != null) { newModule.FormName = model.FormName; newModule.DisplayName = model.DisplayName; newModule.IsActive = model.IsActive; _dbContext.SaveChanges(); result = true; } } catch (Exception ex) { string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message); MessageBox.Show(errMessage, "ServiceModules::UpdateModuleForm", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
private void PopulateDescription() { try { switch (this.ENTITY) { case APP_ENTITIES.INVENTORY_ITEM: TBL_MP_Master_Item dbItem = (new ServiceInventoryItems()).GetItemDBRecord(this.ENTITY_ID); if (dbItem != null) { txtDescription.Text = string.Format("{0}\n{1}\nCODE: {2}", dbItem.Item_Name, dbItem.Long_Description, dbItem.ItemCode); } break; case APP_ENTITIES.PARTIES: Tbl_MP_Master_Party dbParty = (new ServiceParties()).GetPartyByPartyID(this.ENTITY_ID); if (dbParty != null) { txtDescription.Text = string.Format("{0} ({1})\n{2}", dbParty.PartyName, dbParty.PartyType, dbParty.PartyCode); } break; case APP_ENTITIES.INVENTORY_ITEM_ATTACHMENT: TBL_MP_Master_Item_Attachments dbItemAttachment = (new ServiceInventoryItems()).GetInventoryItemAttachmentDBRecord(this.ENTITY_ID); if (dbItemAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbItemAttachment.Title.ToUpper(), dbItemAttachment.TBL_MP_Master_Item.Item_Name, dbItemAttachment.TBL_MP_Master_Item.Long_Description); } break; case APP_ENTITIES.APPLICATION_MODULES: Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID(this.ENTITY_ID); if (dbModule != null) { txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbModule.ModuleName, dbModule.DisplayName); } break; case APP_ENTITIES.MODULES_FORMS: Tbl_MP_Master_Module_Forms dbForm = (new ServiceModules()).GetModuleFormDBRecordByID(this.ENTITY_ID); if (dbForm != null) { txtDescription.Text = string.Format("NAME: {0}\nDISPLAY: {1}", dbForm.FormName, dbForm.DisplayName); } break; case APP_ENTITIES.ROLES: TBL_MP_Master_Role dbRole = (new ServiceRoles()).GetRoleDBRecordByID(this.ENTITY_ID); if (dbRole != null) { txtDescription.Text = string.Format("ROLE NAME: {0}\nROLE NO.: {1}", dbRole.RoleName, dbRole.RoleNo); } break; case APP_ENTITIES.SALES_LEAD_ATTACHMENT: TBL_MP_CRM_SM_SalesLead_Attachment dbLeadAttachment = (new ServiceSalesLead()).GetSalesLeadAttachmentDBRecord(this.ENTITY_ID); if (dbLeadAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbLeadAttachment.Title.ToUpper(), dbLeadAttachment.TBL_MP_CRM_SM_SalesLead.LeadNo, dbLeadAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_ENQUIRY_ATTACHMENT: TBL_MP_CRM_SalesEnquiry_Attachments dbEnquiryAttachment = (new ServiceSalesEnquiry()).GetSalesEnquiryAttachmentDBRecord(this.ENTITY_ID); if (dbEnquiryAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEnquiryAttachment.Title.ToUpper(), dbEnquiryAttachment.TBL_MP_CRM_SalesEnquiry.SalesEnquiry_No, dbEnquiryAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_QUOTATION_ATTACHMENT: TBL_MP_CRM_SalesQuotation_Attachments dbQuoteAttachment = (new ServiceSalesQuotation()).GetSalesQuotationAttachmentDBRecord(this.ENTITY_ID); if (dbQuoteAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbQuoteAttachment.Title.ToUpper(), dbQuoteAttachment.TBL_MP_CRM_SalesQuotation.Quotation_No, dbQuoteAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.SALES_ORDER_ATTACHMENT: TBL_MP_CRM_SalesOrder_Attachment dbOrderAttachment = (new ServiceSalesOrder()).GetSalesOrderAttachmentDBRecord(this.ENTITY_ID); if (dbOrderAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbOrderAttachment.Title.ToUpper(), dbOrderAttachment.TBL_MP_CRM_SalesOrder.SalesOrderNo, dbOrderAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.EMPLOYEES_ATTACHMENT: TBL_MP_Master_Employee_Attachment dbEmpAttachment = (new ServiceEmployee()).GetEmployeeAttachmentDBRecord(this.ENTITY_ID); if (dbEmpAttachment != null) { txtDescription.Text = string.Format("ATTACHMENT: {0}\nITEM:{1}\n{2}", dbEmpAttachment.Title.ToUpper(), dbEmpAttachment.TBL_MP_Master_Employee.EmployeeCode, dbEmpAttachment.TBL_MP_Master_UserList.Description1); } break; case APP_ENTITIES.CONTACTS: Tbl_MP_Master_PartyContact_Detail dbContact = (new ServiceContacts()).GetContactID(this.ENTITY_ID); if (dbContact != null) { txtDescription.Text = string.Format("Contact Person Name : {0}\nAddress:{1}\nMobile No:{2}\nAt.Telephone No:{3}\nEmail ID:{4}\n FAX NO:{5}", dbContact.ContactPersoneName, dbContact.Address, dbContact.MobileNo, dbContact.TelephoneNo, dbContact.EmailID, dbContact.FaxNo); } break; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmDelete::PopulateDescription", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <SelectListItem> GetFormsGridforRole(int roleID) { List <SelectListItem> lstData = new List <SelectListItem>(); try { List <TBL_MP_Master_RoleForm> lstRoleForm = (from xx in _dbContext.TBL_MP_Master_RoleForm where xx.FK_RoleID == roleID select xx).ToList(); foreach (TBL_MP_Master_RoleForm dbItem in lstRoleForm) { string strDescription = string.Empty; Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID((int)dbItem.FK_ModuleId); if (dbModule != null) { strDescription = dbModule.DisplayName.ToUpper(); } Tbl_MP_Master_Module_Forms dbModuleForm = (new ServiceModules()).GetModuleFormDBRecordByID((int)dbItem.FK_FormId); if (dbModuleForm != null) { strDescription = string.Format("{0} ({1})\n", strDescription, dbModuleForm.DisplayName); } if (dbItem.CanAddNew) { strDescription += "ADD "; } if (dbItem.CanApprove) { strDescription += "APPROVE "; } if (dbItem.CanAuthorize) { strDescription += "AUTHORIZE "; } if (dbItem.CanCheck) { strDescription += "CHECK "; } if (dbItem.CanDelete) { strDescription += "DELETE "; } if (dbItem.CanModify) { strDescription += "MODIFY "; } if (dbItem.CanPrepare) { strDescription += "PREPARE "; } if (dbItem.CanPrint) { strDescription += "PRINT "; } if (dbItem.CanView) { strDescription += "VIEW "; } SelectListItem item = new SelectListItem() { ID = dbItem.PK_RoleFormID }; item.Description = strDescription; lstData.Add(item); } } catch (Exception ex) { string strError = ex.Message; if (ex.InnerException != null) { strError += "\n" + ex.InnerException.Message; } MessageBox.Show(strError, "ServiceRoles::GetFormsGridForRoleModule", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(lstData); }