Exemple #1
0
        private void RefreshTabPage()
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                int  statusID = _UNIT.SalesLeadService.GetLeadStatus(this.SelectedLeadID);
                bool readOnly = false;
                if (statusID == Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.LeadStatusClose].DEFAULT_VALUE)
                {
                    readOnly = true;
                }
                if (statusID == Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.LeadStatusLost].DEFAULT_VALUE)
                {
                    readOnly = true;
                }
                if (statusID == Program.LIST_DEFAULTS[(int)APP_DEFAULT_VALUES.LeadStatusConverted].DEFAULT_VALUE)
                {
                    readOnly = true;
                }

                if (readOnly)
                {
                    btnEditLead.Enabled = btnDeleteLead.Enabled = btnGenerateRevision.Enabled = ButtonEnabled.False;
                }
                else
                {
                    btnEditLead.Enabled = btnDeleteLead.Enabled = btnGenerateRevision.Enabled = ButtonEnabled.True;
                }
                switch (this.SelectedTAB)
                {
                case DB_FORM_IDs.SALES_LEAD_GENERAL_INFO:
                    if (_ctrlGeneralDetails == null)
                    {
                        return;
                    }
                    _ctrlGeneralDetails.SelectedLeadID = this.SelectedLeadID;
                    _ctrlGeneralDetails.ReadOnly       = readOnly;
                    _ctrlGeneralDetails.PopulateLeadMasterInfo();
                    this.SelectedLeadNumber = _ctrlGeneralDetails.lblLeadApprovalInfo.Text;
                    break;

                case DB_FORM_IDs.SALES_LEAD_SUSPECT_INFO:
                    if (_ctrlSuspectInfo == null)
                    {
                        return;
                    }
                    _ctrlSuspectInfo.SelectedID = this.SelectedLeadID;
                    _ctrlSuspectInfo.ReadOnly   = readOnly;
                    _ctrlSuspectInfo.PopulateSuspectInfoControls();
                    break;

                case DB_FORM_IDs.SALES_LEAD_ATTACHMENTS:
                    if (_ctrlSalesLeadAttachment == null)
                    {
                        return;
                    }
                    _ctrlSalesLeadAttachment.SelectedEntityID = this.SelectedLeadID;
                    _ctrlSalesLeadAttachment.ReadOnly         = readOnly;
                    _ctrlSalesLeadAttachment.PopulateDocuments();
                    break;

                case DB_FORM_IDs.SALES_LEAD_SCHEDULE_CALLS:
                    if (_ctrlScheduler == null)
                    {
                        return;
                    }
                    _ctrlScheduler.SOURCE_ENTITY_ID = this.SelectedLeadID;
                    _ctrlScheduler.ReadOnly         = readOnly;
                    _ctrlScheduler.PopulateAllSchedules();
                    break;

                case DB_FORM_IDs.SALES_LEAD_ASSOCIATES:
                    if (_ctrlAssociates == null)
                    {
                        return;
                    }
                    _ctrlAssociates.SelectedID = this.SelectedLeadID;
                    _ctrlAssociates.ReadOnly   = readOnly;
                    _ctrlAssociates.PopulateAssociatedEmployees();
                    break;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "pageSalesLead::RefreshTabPage", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
        private void RefreshTabPage()
        {
            bool readOnly = !(new ServiceSalesEnquiry()).IsEnquiryStatusOPEN(this.SelectedEnquiryID);

            if (readOnly)
            {
                btnEditEnquiry.Enabled = btnDeleteEnquiry.Enabled = btnGenerateRevision.Enabled = btnShowBOQ.Enabled = ButtonEnabled.False;
            }
            else
            {
                btnEditEnquiry.Enabled = btnDeleteEnquiry.Enabled = btnGenerateRevision.Enabled = btnShowBOQ.Enabled = ButtonEnabled.True;
            }
            switch (this.SelectedTAB)
            {
            case DB_FORM_IDs.SALES_ENQUIRY_GENERAL_INFO:
                if (_ctrlGeneralDetails == null)
                {
                    return;
                }
                _ctrlGeneralDetails.SelectedEnquiryID = this.SelectedEnquiryID;
                _ctrlGeneralDetails.ReadOnly          = readOnly;
                _ctrlGeneralDetails.PoulateEnquiryMasterInfo();
                break;

            case DB_FORM_IDs.SALES_ENQUIRY_CLIENT_INFO:
                if (_ctrlClientDetails == null)
                {
                    return;
                }
                _ctrlClientDetails.SelectedEnquiryID = this.SelectedEnquiryID;
                _ctrlClientDetails.ReadOnly          = readOnly;
                _ctrlClientDetails.PopulateClientAndConsultantInfo(); break;

            case DB_FORM_IDs.SALES_ENQUIRY_ATTACHMENTS:
                if (_ctrlAttachment == null)
                {
                    return;
                }
                _ctrlAttachment.SelectedEntityID = this.SelectedEnquiryID;
                _ctrlAttachment.ReadOnly         = readOnly;
                _ctrlAttachment.PopulateDocuments();
                break;

            case DB_FORM_IDs.SALES_ENQUIRY_SCHEDULE_CALL:
                if (_ctrlScheduler == null)
                {
                    return;
                }
                _ctrlScheduler.SOURCE_ENTITY_ID = this.SelectedEnquiryID;
                _ctrlScheduler.ReadOnly         = readOnly;
                _ctrlScheduler.PopulateAllSchedules();
                break;

            case DB_FORM_IDs.SALES_ENQUIRY_ASSOCIATES:
                if (_ctrlAssociates == null)
                {
                    return;
                }
                _ctrlAssociates.SelectedID = this.SelectedEnquiryID;
                _ctrlAssociates.ReadOnly   = readOnly;
                _ctrlAssociates.PopulateAssociatedEmployees();
                break;
            }
        }
        private void RefreshTabPage()
        {
            bool readOnly = (new ServiceSalesQuotation()).IsQuotationReadOnly(this.SelectedQuotationID);

            if (readOnly)
            {
                btnEditQuotation.Enabled = btnDeleteQuotation.Enabled = btnGenerateRevision.Enabled = ButtonEnabled.False;
            }
            else
            {
                btnEditQuotation.Enabled = btnDeleteQuotation.Enabled = btnGenerateRevision.Enabled = ButtonEnabled.True;
            }

            switch (this.SelectedTAB)
            {
            case DB_FORM_IDs.SALES_QUOTATION_GENERAL_INFO:
                if (_ctrlGeneralDetails == null)
                {
                    return;
                }
                _ctrlGeneralDetails.SelectedQuotationID = this.SelectedQuotationID;
                _ctrlGeneralDetails.ReadOnly            = readOnly;
                _ctrlGeneralDetails.PoulateSalesQuotationMasterInfo();

                break;

            case DB_FORM_IDs.SALES_QUOTATION_CLIENT_INFO:
                if (_ctrlClientDetails == null)
                {
                    return;
                }
                _ctrlClientDetails.SelectedQuotationID = this.SelectedQuotationID;
                _ctrlClientDetails.ReadOnly            = readOnly;
                _ctrlClientDetails.PopulateClientAndConsultantInfo(); break;

            //case DB_FORM_IDs.SALES_QUOTATION_BOQ:
            //    if (_ControlQuotationBOQ == null) return;
            //    _ControlQuotationBOQ.SalesQuotationID = this.SelectedQuotationID;
            //    _ControlQuotationBOQ.ReadOnly = readOnly;
            //    _ControlQuotationBOQ.PopulateSalesQuotationBOQ();
            //    if (_ctrlGeneralDetails != null)
            //        _ctrlGeneralDetails.UpdateBOQSummary(_ControlQuotationBOQ.MODEL.SUMMARY);
            //    break;
            case DB_FORM_IDs.SALES_QUOTATION_ATTACHMENTS:
                if (_ctrlAttachment == null)
                {
                    return;
                }
                _ctrlAttachment.SelectedEntityID = this.SelectedQuotationID;
                _ctrlAttachment.ReadOnly         = readOnly;
                _ctrlAttachment.PopulateDocuments();
                break;

            case DB_FORM_IDs.SALES_QUOTATION_SCHEDULE_CALL:
                if (_ctrlScheduler == null)
                {
                    return;
                }
                _ctrlScheduler.SOURCE_ENTITY_ID = this.SelectedQuotationID;
                _ctrlScheduler.ReadOnly         = readOnly;
                _ctrlScheduler.PopulateAllSchedules();
                break;

            case DB_FORM_IDs.SALES_QUOTATION_ASSOCIATES:
                if (_ctrlAssociates == null)
                {
                    return;
                }
                _ctrlAssociates.SelectedID = this.SelectedQuotationID;
                _ctrlAssociates.ReadOnly   = readOnly;
                _ctrlAssociates.PopulateAssociatedEmployees();
                break;

            case DB_FORM_IDs.SALES_QUOTATION_TNC:
                if (_ctrlTermsAndConditions == null)
                {
                    return;
                }
                _ctrlTermsAndConditions.SelectedQuotationID = this.SelectedQuotationID;
                _ctrlTermsAndConditions.ReadOnly            = readOnly;
                _ctrlTermsAndConditions.PopulateControl();
                break;
            }
        }
        private void RefreshTabPage()
        {
            bool readOnly = _service.IsSalesOrderReadOnly(this.SelectedOrderID);

            if (readOnly)
            {
                btnAddPrimarySO.Enabled = btnAddWithoutOrderSO.Enabled = btnEditOrder.Enabled = btnDeleteOrder.Enabled = ButtonEnabled.False;
            }
            else
            {
                btnAddPrimarySO.Enabled = btnAddWithoutOrderSO.Enabled = btnEditOrder.Enabled = btnDeleteOrder.Enabled = ButtonEnabled.True;
            }

            switch (this.SelectedTAB)
            {
            case DB_FORM_IDs.SALES_ORDER_GENERAL_INFO:
                if (_ctrlGeneralDetails == null)
                {
                    return;
                }
                _ctrlGeneralDetails.SelectedSalesOrderID = this.SelectedOrderID;
                _ctrlGeneralDetails.ReadOnly             = readOnly;
                _ctrlGeneralDetails.PopulateSalesOrderGeneralInfo();
                break;

            case DB_FORM_IDs.SALES_ORDER_CLIENT_CONTACT:
                if (_ctrlContactDetails == null)
                {
                    return;
                }
                _ctrlContactDetails.SelectedSalesOrderID = this.SelectedOrderID;
                _ctrlContactDetails.ReadOnly             = readOnly;
                _ctrlContactDetails.PopulateClientInfo();
                break;

            case DB_FORM_IDs.SALES_ORDER_ATTACHMENTS:
                if (_ctrlAttachment == null)
                {
                    return;
                }
                _ctrlAttachment.SelectedEntityID = this.SelectedOrderID;
                _ctrlAttachment.PopulateDocuments();
                break;

            case DB_FORM_IDs.SALES_ORDER_ASSOCIATES:
                if (_ctrlAssociates == null)
                {
                    return;
                }
                _ctrlAssociates.SelectedID = this.SelectedOrderID;
                _ctrlAssociates.ReadOnly   = readOnly;
                _ctrlAssociates.PopulateAssociatedEmployees();
                break;

            case DB_FORM_IDs.SALES_ORDER_SCHEDULE_CALL:
                if (_ctrlScheduler == null)
                {
                    return;
                }
                _ctrlScheduler.SOURCE_ENTITY_ID = this.SelectedOrderID;
                _ctrlScheduler.ReadOnly         = readOnly;
                _ctrlScheduler.PopulateAllSchedules();
                break;

            case DB_FORM_IDs.SALES_ORDER_TNC:
                if (_ctrlTermsAndCondition == null)
                {
                    return;
                }
                _ctrlTermsAndCondition.SelectedOrderID = this.SelectedOrderID;
                _ctrlTermsAndCondition.ReadOnly        = readOnly;
                _ctrlTermsAndCondition.PopulateTermsAndConditions();
                break;
            }
        }