Beispiel #1
0
        public bool DeleteModuleMasterInfo(int moduleID, string reason, int deletedBy)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_Module editItem = _dbContext.Tbl_MP_Master_Module.Where(x => x.pk_ModuleId == moduleID).FirstOrDefault();
                editItem.DeleteDatetime = AppCommon.GetServerDateTime();
                // editItem.DeletedBy = CURR_USER.EmployeeID;
                editItem.DeletedBy     = deletedBy;
                editItem.IsActive      = false;
                editItem.DeleteRemarks = reason;
                _dbContext.SaveChanges();
                string strQuery = string.Format("UPDATE Tbl_MP_Master_Module_Forms SET DeletedBy={0}, DeleteDatetime='{1}', DeleteRemarks='{2}',IsActive=0 WHERE FK_ModuleID={3}",
                                                deletedBy, AppCommon.GetServerDateTime().ToString("yyyy-MM-dd hh:ss"), reason, moduleID);
                int cnt = _dbContext.Database.ExecuteSqlCommand(strQuery);
                result = true;
            }
            catch (Exception ex)
            {
                string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
                MessageBox.Show(errMessage, "ServiceModules::DeleteModuleMasterInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
Beispiel #2
0
 private void frmAddEditAppModule_Load(object sender, EventArgs e)
 {
     try
     {
         txtDisplayName.Text = txtModuleName.Text = txtSequence.Text = string.Empty;
         chkIsActive.Checked = true;
         txtSequence.Text    = (new ServiceModules()).GetNewModuleSequenceNo().ToString();
         this.Text           = "Application Module [ADD NEW]";
         if (this.ModuleID != 0)
         {
             Tbl_MP_Master_Module module = (new ServiceModules()).GetModuleDBRecordByID(this.ModuleID);
             if (module != null)
             {
                 txtModuleName.Text  = module.ModuleName;
                 txtDisplayName.Text = module.DisplayName;
                 txtSequence.Text    = module.SequenceNo.ToString();
                 chkIsActive.Checked = module.IsActive;
             }
             this.Text = "Application Module [EDIT]";
         }
     }
     catch (Exception ex)
     {
         string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
         MessageBox.Show(errMessage, "frmAddEditAppModule::frmAddEditAppModule_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);
            }
        }
Beispiel #4
0
        private void gridModules_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                headerGroupDeleteModule.ValuesPrimary.Heading = string.Empty;
                txtDeleteModuleInfo.Text = string.Empty;

                if (e.RowIndex >= 0)
                {
                    SelectedModuleID = (int)gridModules.Rows[e.RowIndex].Cells["ID"].Value;
                    PopulateForms();
                }
                bool isactive = (bool)gridModules.Rows[e.RowIndex].Cells["IsActive"].Value;
                if (isactive)
                {
                    btnRestoreModule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnEditModule.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnDeleteModule.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;

                    btnAddNewForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnEditForm.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnDeleteForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                }
                else
                {
                    btnRestoreModule.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.True;
                    btnEditModule.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnDeleteModule.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;

                    btnAddNewForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnEditForm.Enabled    = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnDeleteForm.Enabled  = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                    btnRestoreForm.Enabled = ComponentFactory.Krypton.Toolkit.ButtonEnabled.False;
                }

                Tbl_MP_Master_Module dbModule = (new ServiceModules()).GetModuleDBRecordByID(this.SelectedModuleID);
                if (dbModule != null)
                {
                    if (dbModule.DeletedBy != null)
                    {
                        string empName = ServiceEmployee.GetEmployeeNameByID((int)dbModule.DeletedBy);
                        headerGroupDeleteModule.ValuesPrimary.Heading = string.Format("Deleted by {0} dt. {1}", empName, dbModule.DeleteDatetime.Value.ToString("dd MMM yy hh:mmtt"));
                    }
                    txtDeleteModuleInfo.Text = dbModule.DeleteRemarks;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "pageModules::gridModules_RowEnter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Tbl_MP_Master_Module model = null;

            try
            {
                errorProvider1.Clear();

                if (this.ValidateChildren())
                {
                    if (this.ModuleID == 0)
                    {
                        model = new Tbl_MP_Master_Module()
                        {
                            ModuleName  = txtModuleName.Text.Trim(),
                            DisplayName = txtDisplayName.Text.Trim(),
                            SequenceNo  = int.Parse(txtSequence.Text.Trim()),
                            IsActive    = chkIsActive.Checked
                        };
                        this.ModuleID = (new ServiceModules()).AddNewModule(model);
                        if (this.ModuleID != 0)
                        {
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                    else
                    {
                        model = (new ServiceModules()).GetModuleDBRecordByID(this.ModuleID);
                        if (model != null)
                        {
                            model.ModuleName  = txtModuleName.Text.Trim();
                            model.DisplayName = txtDisplayName.Text.Trim();
                            model.SequenceNo  = int.Parse(txtSequence.Text.Trim());
                            model.IsActive    = chkIsActive.Checked;
                            bool res = (new ServiceModules()).UpdateModule(model);
                            if (res)
                            {
                                this.DialogResult = DialogResult.OK;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
                MessageBox.Show(errMessage, "frmAddEditAppModule::btnSave_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
Beispiel #6
0
        public Tbl_MP_Master_Module GetModuleDBRecordByID(int moduleID)
        {
            Tbl_MP_Master_Module module = null;

            try
            {
                module = _dbContext.Tbl_MP_Master_Module.Where(x => x.pk_ModuleId == moduleID).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(module);
        }
Beispiel #7
0
        public bool UndeleteModuleMasterInfo(int moduleID, string reason)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_Module editItem = _dbContext.Tbl_MP_Master_Module.Where(x => x.pk_ModuleId == moduleID).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::UndeleteModuleMasterInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
Beispiel #8
0
        public int AddNewModule(Tbl_MP_Master_Module model)
        {
            int newID = 0;

            try
            {
                Tbl_MP_Master_Module newModule = new Tbl_MP_Master_Module();
                newModule.ModuleName  = model.ModuleName;
                newModule.DisplayName = model.DisplayName;
                newModule.IsActive    = model.IsActive;
                newModule.SequenceNo  = model.SequenceNo;
                _dbContext.Tbl_MP_Master_Module.Add(newModule);
                _dbContext.SaveChanges();
                newID = newModule.pk_ModuleId;
            }
            catch (Exception ex)
            {
                string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.InnerException.Message);
                MessageBox.Show(errMessage, "ServiceModules::AddNewModule", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(newID);
        }
Beispiel #9
0
        public bool UpdateModule(Tbl_MP_Master_Module model)
        {
            bool result = false;

            try
            {
                Tbl_MP_Master_Module newModule = _dbContext.Tbl_MP_Master_Module.Where(x => x.pk_ModuleId == model.pk_ModuleId).FirstOrDefault();
                if (newModule != null)
                {
                    newModule.ModuleName  = model.ModuleName;
                    newModule.DisplayName = model.DisplayName;
                    newModule.IsActive    = model.IsActive;
                    newModule.SequenceNo  = model.SequenceNo;
                    _dbContext.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                string errMessage = string.Format("{0}\n{1}", ex.Message, ex.InnerException.Message);
                MessageBox.Show(errMessage, "ServiceModules::UpdateModule", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(result);
        }
Beispiel #10
0
        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);
            }
        }
Beispiel #11
0
        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);
        }