示例#1
0
 private void SetSalesLeadTabAsPerPermission()
 {
     try
     {
         foreach (KryptonPage tabSelected in tabREVIEWS.Pages)
         {
             if (tabSelected.Tag != null)
             {
                 WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)tabSelected.Tag).FirstOrDefault();
                 if (model != null)
                 {
                     tabSelected.Visible = model.CanView;
                     if (tabSelected.Visible)
                     {
                         switch ((DB_FORM_IDs)model.FormID)
                         {
                         case DB_FORM_IDs.SALES_QUOTATION_REVIEW_ATTACHMENTS: InitializeAttachmentInfoControl(); break;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "pageSalesLead::SetSalesLeadTabAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void PageHolidayAndWeekOffs_Load(object sender, EventArgs e)
        {
            try
            {
                PopulateAllFinancialYearsInGrid();
                WhosWhoModel permission = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.HOLIDAYS_AND_WEEKOFFS).FirstOrDefault();
                if (permission.CanAddNew || permission.CanModify)
                {
                    btnUpdateHoliday.Enabled = ButtonEnabled.True;
                }
                else
                {
                    btnUpdateHoliday.Enabled = ButtonEnabled.False;
                }

                btnDeleteHoliday.Enabled = (permission.CanDelete) ? ButtonEnabled.True : ButtonEnabled.False;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageHolidayAndWeekOffs::PageHolidayAndWeekOffs_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void SetMenuButtonAsPerPermission()
 {
     try
     {
         foreach (ToolStripItem btnMenu in toolStripMain.Items)
         {
             if (btnMenu.GetType() == typeof(ToolStripButton))
             {
                 if (btnMenu.Tag != null)
                 {
                     WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)btnMenu.Tag).FirstOrDefault();
                     if (model != null)
                     {
                         btnMenu.Visible = model.CanView;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageUserInfo::SetMenuButtonAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void ControlEmployeeGeneralInfo_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                PopulateEmployeeCategories();
                PopulateDepartments();
                PopulateDesignations();
                PopulateBranches();
                PopulateLocations();
                PopulateEmployeesBoss();

                WhosWhoModel whoseWho = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.EMPLOYEE_GENERAL_INFO).FirstOrDefault();
                if (whoseWho != null)
                {
                    btnUpdateGeneralInfo.Visible = btnUpdateResignInfo.Visible = btnUploadPicture.Visible = whoseWho.CanModify;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlEmployeeGeneralInfo::ControlEmployeeGeneralInfo_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
示例#5
0
 private void SetPermissionwiseButtonStatus()
 {
     try
     {
         WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.FormOperationID).FirstOrDefault();
         if (model != null)
         {
             if (!model.CanAddNew)
             {
                 btnAddNewCategory.Enabled = btnAddNewItem.Enabled = ButtonEnabled.False;
             }
             if (!model.CanModify)
             {
                 btnEditCategory.Enabled = btnEditItem.Enabled = btnUpdateSpecifications.Enabled = ButtonEnabled.False;
             }
             if (!model.CanDelete)
             {
                 btnDeleteItem.Enabled = ButtonEnabled.False;
             }
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "pageInventoryItems::SetPermissionwiseButtonStatus", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void PageLeavesRegister_Load(object sender, EventArgs e)
        {
            try
            {
                // STAR SERVICE WITH EVEN HANDLER
                _ServiceLeaves = new ServiceLeaveApplication();
                _ServiceLeaves.EmployeeRecordCompleted += _ServiceLeaves_EmployeeRecordCompleted;

                btnApproveReject.Visible = false;
                WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.LEAVE_APPLICATIONS).FirstOrDefault();
                if (model.CanApprove)
                {
                    btnApproveReject.Visible = true;
                }

                PopulateLavesGrid();
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "PageLeavesRegister::PageLeavesRegister_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#7
0
 private void SetMenuButtonAsPerPermission()
 {
     try
     {
         foreach (ToolStripItem btnMenu in toolStripHRMenu.Items)
         {
             if (btnMenu.GetType() == typeof(ToolStripMenuItem))
             {
                 if (btnMenu.Tag != null)
                 {
                     WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)btnMenu.Tag).FirstOrDefault();
                     if (model != null)
                     {
                         btnMenu.Visible = model.CanView;
                     }
                 }
             }
             if (btnMenu.GetType() == typeof(ToolStripButton))
             {
                 if (btnMenu.Tag != null)
                 {
                     WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)btnMenu.Tag).FirstOrDefault();
                     if (model != null)
                     {
                         btnMenu.Visible = model.CanView;
                     }
                 }
             }
             if (btnMenu.GetType() == typeof(ToolStripDropDownButton))
             {
                 ToolStripDropDownButton dropDownBtn = (ToolStripDropDownButton)btnMenu;
                 foreach (ToolStripItem item in dropDownBtn.DropDownItems)
                 {
                     if (item.Tag != null)
                     {
                         WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)item.Tag).FirstOrDefault();
                         if (model != null)
                         {
                             ((ToolStripMenuItem)item).Visible = model.CanView;
                         }
                     }
                 }
             }
         }
         mnuAttendance.Visible = mnuAttendance.Enabled = true;
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "pageHRLanding::SetMenuButtonAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void SetSalesQuotationTabAsPerPermission()
        {
            WhosWhoModel model = null;

            try
            {
                foreach (KryptonPage tabSelected in tabQuotation.Pages)
                {
                    if (tabSelected.Tag != null)
                    {
                        model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)tabSelected.Tag).FirstOrDefault();
                        if (model != null)
                        {
                            tabSelected.Visible = model.CanView;
                            if (tabSelected.Visible)
                            {
                                switch ((DB_FORM_IDs)model.FormID)
                                {
                                case DB_FORM_IDs.SALES_QUOTATION_GENERAL_INFO: InitializeQuotationGeneralInfoControl(); break;

                                case DB_FORM_IDs.SALES_QUOTATION_CLIENT_INFO: InitializeClientDetailsControl(); break;

                                case DB_FORM_IDs.SALES_QUOTATION_ATTACHMENTS: InitializeAttachmentInfoControl(); break;

                                case DB_FORM_IDs.SALES_QUOTATION_ASSOCIATES: InitializeAssociatesInfoControl(); break;

                                case DB_FORM_IDs.SALES_QUOTATION_SCHEDULE_CALL: InitializeSchedulerInfoControl(); break;

                                case DB_FORM_IDs.SALES_QUOTATION_TNC: InitializeTermsAndConditionsInfoControl(); break;
                                }
                            }
                        }
                    }
                }
                model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_QUOTATION_BOQ).FirstOrDefault();
                if (model != null)
                {
                    btnSalesBOQ.Visible = model.CanView;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageSalesQuotation::SetSalesQuotationTabAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#9
0
        private void SetEmployeeInfoTabAsPerPermission()
        {
            try
            {
                foreach (KryptonPage tabSelected in tabEmployees.Pages)
                {
                    if (tabSelected.Tag != null)
                    {
                        WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)tabSelected.Tag).FirstOrDefault();
                        if (model != null)
                        {
                            tabSelected.Visible = model.CanView;
                            if (tabSelected.Visible)
                            {
                                switch ((DB_FORM_IDs)model.FormID)
                                {
                                case DB_FORM_IDs.EMPLOYEE_GENERAL_INFO: InitializeEmployeeGeneralInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_PERSONAL_DETAILS: InitializeEmployeePersonalInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_BANK_DETAILS: InitializeEmployeeBankInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_ATTACHMENT: InitializeAttachmentInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_OTHER_DETAIL: InitializeEmployeeOtherInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_ADDITIONAL_DETAILS: InitializeEmployeeAdditionalInfoControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_LEAVE_CONFIGURATION: InitializeEmployeeLeaveConfigControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_CTC_INFO: InitializeEmployeeCTCControl(); break;

                                case DB_FORM_IDs.EMPLOYEE_AUTHORITIES: InitializeEmployeeAuthoritiesControl(); break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageEmployees::SetEmployeeInfoTabAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#10
0
        private void SetProjectTabAsPerPermission()
        {
            WhosWhoModel model = null;

            try
            {
                // SET TAB PAGES VISIBILITYY AS PER PERMISSION
                foreach (KryptonPage currPage in tabProject.Pages)
                {
                    if (currPage.Tag != null)
                    {
                        DB_FORM_IDs currOperation = (DB_FORM_IDs)currPage.Tag;
                        model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == currOperation).FirstOrDefault();
                        if (model != null)
                        {
                            currPage.Visible = model.CanView;
                            switch ((DB_FORM_IDs)model.FormID)
                            {
                            case DB_FORM_IDs.PROJECT_CLOSER_CHECKLIST: InitializeControlProjectCloserChecklist(); break;

                            case DB_FORM_IDs.PROJECT_PLANNING: InitializeProjectPlanControl(); break;

                            case DB_FORM_IDs.PROJECT_GENERAL_INFO: InitializeProjectGeneralInfoControl(); break;
                            }
                        }
                    }
                }

                // SET  BUTTON VISIBILITY AS PER PERMISSION
                model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.PROJECT).FirstOrDefault();
                if (model != null)
                {
                    btnAddNewProject.Visible = model.CanAddNew;
                    btnEditProject.Visible   = model.CanModify;
                    btnDeleteProject.Visible = model.CanDelete;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pagePMC::SetProjectTabAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#11
0
        private void SetSalesEnquiryTabAsPerPermission()
        {
            try
            {
                WhosWhoModel model = null;
                foreach (KryptonPage tabSelected in tabSalesEnquiry.Pages)
                {
                    if (tabSelected.Tag != null)
                    {
                        model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)tabSelected.Tag).FirstOrDefault();
                        if (model != null)
                        {
                            tabSelected.Visible = model.CanView;
                            if (tabSelected.Visible)
                            {
                                switch ((DB_FORM_IDs)model.FormID)
                                {
                                case DB_FORM_IDs.SALES_ENQUIRY_GENERAL_INFO: InitializeEnquiryMasterInfoControl(); break;

                                case DB_FORM_IDs.SALES_ENQUIRY_CLIENT_INFO:  InitializeClientDetailsControl(); break;

                                case DB_FORM_IDs.SALES_ENQUIRY_ATTACHMENTS:  InitializeAttachmentInfoControl(); break;

                                case DB_FORM_IDs.SALES_ENQUIRY_ASSOCIATES:   InitializeAssociatesInfoControl(); break;

                                case DB_FORM_IDs.SALES_ENQUIRY_SCHEDULE_CALL: InitializeSchedulerInfoControl(); break;
                                }
                            }
                        }
                    }
                }

                // SET SHOW BOQ BUTTON VISIBILITY AS PER PERMISSION
                model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_ENQUIRY_DESIGN_BOQ).FirstOrDefault();
                btnShowBOQ.Visible = model.CanView;
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageCRMLanding::SetMenuButtonAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#12
0
        private void SetSalesLeadTabAsPerPermission()
        {
            try
            {
                foreach (KryptonPage tabSelected in tabSalesLead.Pages)
                {
                    if (tabSelected.Tag != null)
                    {
                        WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == (DB_FORM_IDs)tabSelected.Tag).FirstOrDefault();
                        if (model != null)
                        {
                            tabSelected.Visible = model.CanView;
                            if (tabSelected.Visible)
                            {
                                switch ((DB_FORM_IDs)model.FormID)
                                {
                                case DB_FORM_IDs.SALES_LEAD_GENERAL_INFO: InitializeLeadMasterInfoControl(); break;

                                case DB_FORM_IDs.SALES_LEAD_SUSPECT_INFO: InitializeSuspectInfoControl(); break;

                                case DB_FORM_IDs.SALES_LEAD_ATTACHMENTS: InitializeAttachmentInfoControl(); break;

                                case DB_FORM_IDs.SALES_LEAD_SCHEDULE_CALLS: InitializeSchedulerInfoControl(); break;

                                case DB_FORM_IDs.SALES_LEAD_ASSOCIATES: InitializeAssociatesInfoControl(); break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageSalesLead::SetSalesLeadTabAsPerPermission", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void PageAdvanceRequestsRegister_Load(object sender, EventArgs e)
 {
     try
     {
         PopulateAdvanceRequestGrid();
         btnApproveReject.Visible = false;
         WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.ADVANCE_REQUEST).FirstOrDefault();
         if (model.CanApprove)
         {
             btnApproveReject.Visible = true;
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "PageAdvanceRequestsRegister::PageAdvanceRequestsRegister_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#14
0
        public void PopulateLeadMasterInfo()
        {
            try
            {
                LeadMasterInfoModel _masterInfo = (new ServiceSalesLead()).GetLeadMasterInfo(this.SelectedLeadID);
                if (_masterInfo != null)
                {
                    headerGroupMain.ValuesPrimary.Heading = string.Format("{0} dt. {1}", _masterInfo.LeadNo, _masterInfo.LeadDate.Value.ToString("dd-MM-yyyy"));

                    headerStatus.Text        = string.Format("Status : {0}", _masterInfo.LeadStatus.ToUpper());
                    txtStatusDetails.Text    = _masterInfo.LeadStatusDescription;
                    lblLeadApprovalInfo.Text = _masterInfo.ApprovedBy;
                    lblLeadApprovalInfo.StateCommon.Back.Color1 = (_masterInfo.IsApproved)? Color.Green : Color.Red;
                    if (!ReadOnly)
                    {
                        WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.SALES_LEAD_FORM_ID).FirstOrDefault();
                        if (model != null)
                        {
                            if (model.CanApprove)
                            {
                                if (_masterInfo.IsApproved == false)
                                {
                                    btnApproveLead.Visible = true;
                                }
                                else
                                {
                                    btnApproveLead.Visible = false;
                                }
                            }
                            else
                            {
                                btnApproveLead.Visible = false;
                            }
                        }
                    }

                    lblLeadName.Text       = string.Format("{0}", _masterInfo.LeadName);
                    lblWebSiteEmailId.Text = String.Format("{0}", _masterInfo.WebSite);
                    lblEmailId.Text        = string.Format("{0}", _masterInfo.EmailId);
                    lblLedRequirement.Text = string.Format("{0}", _masterInfo.LeadRequirement);
                    lblLeadSource.Text     = string.Format("{0}", _masterInfo.LeadSource);

                    lblEstimatedValue.Text = string.Format("{1} {0:0.00}", _masterInfo.EstimatedValue, _masterInfo.EstimatedValueCurrency);

                    lblGeneratedBy.Text = string.Format("{0}", _masterInfo.GeneratedBy);

                    lblAssignedTo.Text    = string.Format("{0}", _masterInfo.AssignedTo);
                    lblProjectSector.Text = string.Format("{0}", _masterInfo.ProjectSector);

                    gridContacts.DataSource = _service.GetContactsForLeadID(this.SelectedLeadID);
                    gridContacts.Columns["Selected"].Visible = gridContacts.Columns["ContactID"].Visible = false;

                    headerGroupMain.ValuesSecondary.Heading     = _masterInfo.CreationInfo;
                    headerGroupMain.ValuesSecondary.Description = _masterInfo.ModificationInfo;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ctrlSalesLeadGeneralDetails::PoulateLeadMasterInfo");
            }
        }
        public void PoulateEnquiryMasterInfo()
        {
            try
            {
                DoBlanks();
                TBL_MP_CRM_SalesEnquiry _masterInfo    = (new ServiceSalesEnquiry()).GetEnquiryMasterDBInfo(SelectedEnquiryID);
                ServiceMASTERS          _masterService = new ServiceMASTERS();
                if (_masterInfo != null)
                {
                    txtLeadInfo.Text = "--";
                    if (_masterInfo.TBL_MP_CRM_SM_SalesLead != null)
                    {
                        txtLeadInfo.Text = string.Format("{0} dt. {1}", _masterInfo.TBL_MP_CRM_SM_SalesLead.LeadNo, _masterInfo.TBL_MP_CRM_SM_SalesLead.LeadDate.ToString("dd MMM yyyy"));
                    }

                    txtEnquiryInfo.Text = string.Format("{0}  dt. {1}", _masterInfo.SalesEnquiry_No, _masterInfo.SalesEnquiry_Date.ToString("dd MMM yyyy hh:mmtt"));

                    if (_masterInfo.Enquiry_Due_Date != null)
                    {
                        txtEnquiryDueDate.Text = string.Format("{0}", _masterInfo.Enquiry_Due_Date.Value.ToString("dd MMM yyyy"));
                    }

                    txtEnquiryGeneratedBy.Text = (_masterInfo.Enquiry_Genrated_By == "R") ? "REFERENCE" : ((_masterInfo.Enquiry_Genrated_By == "A") ? "AGENT" : "EMPLOYEE");
                    txtGeneratedByName.Text    = _masterInfo.Enquiry_Genrated_By_Name;
                    if (_masterInfo.FK_Userlist_EnquirySource_ID != 0)
                    {
                        txtEnquirySource.Text = _masterService.GetAllSalesEnquirySources().Where(x => x.ID == _masterInfo.FK_Userlist_EnquirySource_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtEnquirySource.Text = "--";
                    }

                    if (_masterInfo.FK_Userlist_Submission_Mode_ID != 0)
                    {
                        txtSubmissionMode.Text = _masterService.GetAllSalesEnquirySubmissionMode().Where(x => x.ID == _masterInfo.FK_Userlist_Submission_Mode_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtSubmissionMode.Text = "--";
                    }

                    if (_masterInfo.FK_Userlist_Enquiry_Status_ID != 0)
                    {
                        txtEnquiryStatus.Text = _masterService.GetAllSalesEnquiryStatuses().Where(x => x.ID == _masterInfo.FK_Userlist_Enquiry_Status_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtEnquiryStatus.Text = "--";
                    }
                    headerStatus.Text = string.Format("Status : {0}", txtEnquiryStatus.Text.ToUpper());
                    if (_masterInfo.FK_Userlist_Enquiry_Status_ID != Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.EnquiryStatusOpen].DEFAULT_VALUE)
                    {
                        txtStatusDetails.Text = _masterInfo.ReasonClose;
                    }
                    else
                    {
                        txtStatusDetails.Text = string.Empty;
                    }

                    txtDescription.Text = _masterInfo.General_Description;
                    if (_masterInfo.FK_AssignedTo != 0)
                    {
                        txtAssignedTo.Text = ServiceEmployee.GetEmployeeNameByID(_masterInfo.FK_AssignedTo);
                    }
                    else
                    {
                        txtAssignedTo.Text = "--";
                    }

                    if (_masterInfo.FK_Userlist_ProjectType_ID != 0)
                    {
                        txtProjectSector.Text = _masterService.GetAllProjectSectors().Where(x => x.ID == _masterInfo.FK_Userlist_ProjectType_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtProjectSector.Text = "--";
                    }

                    txtProjectName.Text  = _masterInfo.Project_Name;
                    txtProjectValue.Text = string.Format("{0:0.00}", _masterInfo.Project_Value);

                    if (_masterInfo.FK_Userlist_ProjectStatus_ID != 0)
                    {
                        txtProjectStatus.Text = _masterService.GetAllProjectStatuses().Where(x => x.ID == _masterInfo.FK_Userlist_ProjectStatus_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtProjectStatus.Text = "--";
                    }

                    if (_masterInfo.FK_Userlist_Project_SubType_ID != 0)
                    {
                        txtProjectSubType.Text = _masterService.GetAllProjectTypes().Where(x => x.ID == _masterInfo.FK_Userlist_Project_SubType_ID).FirstOrDefault().Description.ToUpper();
                    }
                    else
                    {
                        txtProjectSubType.Text = "--";
                    }


                    if (_masterInfo.FK_Project_Country_ID != null)
                    {
                        if (_masterInfo.FK_Project_Country_ID != 0)
                        {
                            txtProjectCountry.Text = _masterService.GetAllCountries().Where(x => x.ID == _masterInfo.FK_Project_Country_ID).FirstOrDefault().Description.ToUpper();
                        }
                        else
                        {
                            txtProjectCountry.Text = "--";
                        }
                    }
                    if (_masterInfo.FK_Project_State_ID != null)
                    {
                        if (_masterInfo.FK_Project_State_ID != 0)
                        {
                            txtProjectState.Text = _masterService.GetAllStatesForCountry((int)_masterInfo.FK_Project_Country_ID).Where(x => x.ID == _masterInfo.FK_Project_State_ID).FirstOrDefault().Description.ToUpper();
                        }
                        else
                        {
                            txtProjectState.Text = "--";
                        }
                    }
                    if (_masterInfo.FK_Project_City_ID != null)
                    {
                        if (_masterInfo.FK_Project_City_ID != 0)
                        {
                            txtProjectCity.Text = _masterService.GetAllCitiesForState((int)_masterInfo.FK_Project_State_ID).Where(x => x.ID == _masterInfo.FK_Project_City_ID).FirstOrDefault().Description.ToUpper();
                        }
                        else
                        {
                            txtProjectCity.Text = "--";
                        }
                    }

                    if (_masterInfo.FK_PreparedBy != null)
                    {
                        string strPreparedByName = ServiceEmployee.GetEmployeeNameByID((int)_masterInfo.FK_PreparedBy);
                        headerBottom.Values.Heading = string.Format("Created : {0} {1}", strPreparedByName, _masterInfo.CreatedDatetime.Value.ToString("dd MMM yyyy hh:mmtt"));
                    }
                    if (_masterInfo.LastModifiedBy != null)
                    {
                        string strModifiedByName = ServiceEmployee.GetEmployeeNameByID((int)_masterInfo.LastModifiedBy);
                        headerBottom.Values.Description = string.Format("Modified : {0} {1}", strModifiedByName, _masterInfo.LastModifiedDate.Value.ToString("dd MMM yyyy hh:mmtt"));
                    }

                    if (_masterInfo.FK_ApprovedBy == null)
                    {
                        lblEnquiryApprovalInfo.Text = "UN-APPROVED";
                        lblEnquiryApprovalInfo.StateCommon.Back.Color1 = Color.Red;
                    }
                    else
                    {
                        lblEnquiryApprovalInfo.Text = string.Format("APPROVED : {0}", ServiceEmployee.GetEmployeeNameByID((int)_masterInfo.FK_ApprovedBy));
                        lblEnquiryApprovalInfo.StateCommon.Back.Color1 = Color.Green;
                    }

                    if (!ReadOnly)
                    {
                        WhosWhoModel model = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.SALES_ENQUIRY_FORM_ID).FirstOrDefault();
                        if (model != null)
                        {
                            if (model.CanApprove)
                            {
                                if (_masterInfo.FK_ApprovedBy == null)
                                {
                                    btnApproveEnquiry.Visible = true;
                                }
                                else
                                {
                                    btnApproveEnquiry.Visible = false;
                                }
                            }
                            else
                            {
                                btnApproveEnquiry.Visible = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ctrlSalesEnquiryGeneralDetails::PoulateEnquiryMasterInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void PoulateSalesQuotationMasterInfo()
        {
            try
            {
                TBL_MP_CRM_SalesQuotation dbModel = (new ServiceSalesQuotation()).GetSalesQuotationMasterDBInfo(this.SelectedQuotationID);
                if (dbModel != null)
                {
                    txtSalesQuotationNo.Text   = dbModel.Quotation_No;
                    txtSalesQuotationDate.Text = dbModel.Quotation_Date.ToString("dd MMM yyyy");
                    txtSalesEnquiryNo.Text     = dbModel.TBL_MP_CRM_SalesEnquiry.SalesEnquiry_No;
                    txtSalesEnquiryDate.Text   = dbModel.TBL_MP_CRM_SalesEnquiry.SalesEnquiry_Date.ToString("dd MMM yyyy");
                    txtClientName.Text         = dbModel.Tbl_MP_Master_Party.PartyName;
                    txtRemarks.Text            = dbModel.Remarks;

                    // GETTING SALES QUOTATION STATUS
                    SelectListItem selStatus = (new ServiceSalesQuotation()).GetAllActiveQuotationStatusesList().Where(x => x.ID == dbModel.FK_Userlist_Quotation_Status_ID).FirstOrDefault();
                    if (selStatus != null)
                    {
                        lblQuotationStatus.Text = String.Format("STATUS : {0}", selStatus.Description);
                    }


                    ServiceEmployee        _empService = new ServiceEmployee();
                    TBL_MP_Master_Employee obj         = _empService.GetEmployeeDbRecordByID(dbModel.FK_RepresentativeID);
                    if (obj != null)
                    {
                        txtSalesRepresentativeName.Text = obj.EmployeeName;
                        lblSalesRepresentativeCode.Text = string.Format("Code: {0}", obj.EmployeeCode);
                    }
                    obj = _empService.GetEmployeeDbRecordByID(dbModel.FK_BOQRepresentativeID);
                    if (obj != null)
                    {
                        txtBOQRepresentativeName.Text = obj.EmployeeName;
                        lblBoqRepresentativeCode.Text = string.Format("Code: {0}", obj.EmployeeCode);
                    }
                    headerBottom.Values.Heading = string.Format("Created: {0} dt. {1}", ServiceEmployee.GetEmployeeNameByID(dbModel.FK_PreparedBy), dbModel.CreatedDatetime);
                    if (dbModel.LastModifiedBy != null)
                    {
                        headerBottom.Values.Description = string.Format("Modified: {0} dt. {1}", ServiceEmployee.GetEmployeeNameByID((int)dbModel.LastModifiedBy), dbModel.LastModifiedDate);
                    }
                    else
                    {
                        headerBottom.Values.Description = string.Empty;
                    }

                    lblQuotationApprovalInfo.Text = "Unapproved Quotation";
                    lblQuotationApprovalInfo.StateCommon.Back.Color1 = (dbModel.FK_ApprovedBy == null) ? Color.Red : Color.Green;
                    WhosWhoModel premission = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_QUOTATION).FirstOrDefault();
                    if (premission != null)
                    {
                        if (premission.CanApprove)
                        {
                            if (dbModel.FK_ApprovedBy == null)
                            {
                                btnApprove.Visible = true;
                            }
                            else
                            {
                                lblQuotationApprovalInfo.Text = string.Format("Approved: {0}", ServiceEmployee.GetEmployeeNameByID((int)dbModel.FK_ApprovedBy));
                                btnApprove.Visible            = false;
                            }
                        }
                        else
                        {
                            btnApprove.Visible = false;
                        }
                    }
                }

                ServiceSalesQuotationBOQ _service = new ServiceSalesQuotationBOQ();
                SalesQuotationBOQSummary model    = _service.GetQuotationBOQSummaryForQuotationID(this.SelectedQuotationID);
                if (model != null)
                {
                    PopulateBOQSummary(model);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesQuotaionGeneralDetails::PoulateSalesQuotationMasterInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void PopulateSalesOrderGeneralInfo()
        {
            this.Cursor = Cursors.WaitCursor;
            ServiceSalesOrder _service = new ServiceSalesOrder();

            try
            {
                //btnApproveSO.Visible = true;
                DoBlanks();
                SelectListItem        selItem = null;
                List <SelectListItem> lst     = _service.GetAllSalesOrderStatuses();

                TBL_MP_CRM_SalesOrder model = (new ServiceSalesOrder()).GetSalesOrderDBInfoByID(SelectedSalesOrderID);
                if (model != null)
                {
                    headerGroupMain.ValuesPrimary.Heading = model.SalesOrderNo;
                    //  lblSOApprovalInfo.Text =model.FK_ApprovedBy.ToString();
                    // lblSOApprovalInfo.StateCommon.Back.Color1 = (model.IsApproved) ? Color.Green : Color.Red;


                    selItem          = lst.Where(x => x.ID == model.FK_SalesOrderStatus).FirstOrDefault();
                    txtSOStatus.Text = selItem.Description;

                    lst              = (new ServiceMASTERS()).GetAllPOSources();
                    selItem          = lst.Where(x => x.ID == model.FK_POSource).FirstOrDefault();
                    txtPOSource.Text = selItem.Description;

                    if (model.MaterialSupplyPONo != null)
                    {
                        txtMaterialSupplyInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}",
                                                                   model.MaterialSupplyPONo,
                                                                   ((DateTime)model.MaterialSupplyPODate).ToString("dd MMM yyyy"),
                                                                   model.MaterialSupplyPOValidDays,
                                                                   ((DateTime)model.MaterialSupplyPOExpiryDate).ToString("dd/MM/yy"));
                    }


                    if (model.InstallationServicePONo != null)
                    {
                        txtInstallationServicesInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}",
                                                                         model.InstallationServicePONo,
                                                                         ((DateTime)model.InstallationServicePODate).ToString("dd MMM yyyy"),
                                                                         model.InstallationServicePOValidDays,
                                                                         ((DateTime)model.InstallationServicePOExpiryDate).ToString("dd/MM/yy"));
                    }
                    if (model.FK_ClientID != null)
                    {
                        txtClientName.Text = String.Format("{0} ({1}) ",
                                                           model.Tbl_MP_Master_Party.PartyName,
                                                           model.Tbl_MP_Master_Party.PartyCode);
                    }
                    if (model.FK_QuotationID != null)
                    {
                        txtQuotationInfo.Text = String.Format("{0} dt. {1} ",
                                                              model.TBL_MP_CRM_SalesQuotation.Quotation_No,
                                                              model.TBL_MP_CRM_SalesQuotation.Quotation_Date.ToString("dd MMM yyyy"));
                    }

                    if (model.FK_ProjectID != null)
                    {
                        headerProject.Values.Heading = "PROJECT: " + model.TBL_MP_PMC_ProjectMaster.ProjectNumber;
                        txtProjectName.Text          = model.TBL_MP_PMC_ProjectMaster.ProjectName;
                        txtStartDate.Text            = model.TBL_MP_PMC_ProjectMaster.StartDate.ToString("dd MMM yyyy");
                        txtEndDate.Text = model.TBL_MP_PMC_ProjectMaster.EndDate.ToString("dd MMM yyyy");
                        ServiceProject serviceProject = new ServiceProject();
                        txtBillingAddress.Text = serviceProject.GetProjectBillingAddress((int)model.FK_ProjectID);
                        txtSiteAddr.Text       = serviceProject.GetProjectSiteAddress((int)model.FK_ProjectID);
                    }

                    if (model.FK_ApprovedBy == null)
                    {
                        lblSOApprovalInfo.Text = "UN-APPROVED";
                        lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Red;
                    }
                    else
                    {
                        lblSOApprovalInfo.Text = string.Format("APPROVED : {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy));
                        lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Green;
                    }

                    if (!ReadOnly)
                    {
                        WhosWhoModel modell = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.SALES_ORDER_FORM_ID).FirstOrDefault();
                        if (modell != null)
                        {
                            if (modell.CanApprove)
                            {
                                if (model.FK_ApprovedBy == null)
                                {
                                    btnApproveSO.Visible = true;
                                }
                                else
                                {
                                    btnApproveSO.Visible = false;
                                }
                            }
                            else
                            {
                                btnApproveSO.Visible = false;
                            }
                        }
                    }

                    /*
                     * lblSOApprovalInfo.Text = "Unapproved Order";
                     * lblSOApprovalInfo.StateCommon.Back.Color1 = (model.FK_ApprovedBy == null) ? Color.Red : Color.Green;
                     * WhosWhoModel premission = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_ORDER).FirstOrDefault();
                     * if (premission != null)
                     * {
                     *   if (premission.CanApprove)
                     *       if (model.FK_ApprovedBy == null)
                     *           btnApproveSO.Visible = true;
                     *       else
                     *       {
                     *           lblSOApprovalInfo.Text = string.Format("Approved: {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy));
                     *           btnApproveSO.Visible = false;
                     *       }
                     *   else
                     *       btnApproveSO.Visible = false;
                     * }
                     */
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(ex.Message, "ControlSalesOrderGeneralInfo::PopulateSalesOrderGeneralInfo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }