Example #1
0
        public void PopulateDesingBOQ()
        {
            MODEL = null;
            tabBOQSheets.Pages.Clear();
            this.Cursor = Cursors.WaitCursor;
            try
            {
                headerBOQMenu.Values.Heading = String.Empty;
                TBL_MP_CRM_SalesEnquiry_BOQ dbModel = (new ServiceSalesEnquiryBOQ()).GetDesignBOQdbInfo(this.SalesEnquiryID);
                if (dbModel != null)
                {
                    MODEL = JsonConvert.DeserializeObject <SalesEnquiryDesignBOQViewModel>(dbModel.BOQ_DESIGN_OBJECT);
                    if (MODEL != null) // DRAW ALL SHEETS
                    {
                        MODEL.BOQ_ID                 = dbModel.DESIGN_BOQ_ID;
                        MODEL.BOQ_NUMBER             = dbModel.BOQ_NUMBER;
                        MODEL.ENQUIRY_ID             = dbModel.ENQUIRY_ID;
                        headerBOQMenu.Values.Heading = MODEL.BOQ_NUMBER;
                        foreach (SalesEnquiryDesignBOQSheet sheet in MODEL.SHEETS)
                        {
                            KryptonPage pageBOQSheet = new KryptonPage()
                            {
                                Text = sheet.SheetName, Name = string.Format("page{0}", tabBOQSheets.Pages.Count + 1)
                            };
                            ControlSalesEnquiryDesignBOQSheet _sheetControl = new ControlSalesEnquiryDesignBOQSheet(sheet);
                            pageBOQSheet.Controls.Add(_sheetControl);
                            _sheetControl.Dock = DockStyle.Fill;
                            tabBOQSheets.Pages.Add(pageBOQSheet);
                            _sheetControl.ParentTabPage = pageBOQSheet;
                            _sheetControl.PopulateBOQItemsGrid();
                            tabBOQSheets.SelectedPage = pageBOQSheet;
                            _sheetControl.Visible     = true;
                            _sheetControl.ReadOnly    = this.ReadOnly;
                            //_sheetControl.SetBOQItemsGridColumnSizes();
                            _sheetControl.SetBOQItemsGridColumnSizes();
                        }
                    }
                }
                else
                {
                    CreateDefaultBOQSheet();
                }

                foreach (KryptonPage page in tabBOQSheets.Pages)
                {
                    ControlSalesEnquiryDesignBOQSheet sheet = (ControlSalesEnquiryDesignBOQSheet)page.Controls[0];
                    sheet.SetBOQItemsGridColumnSizes();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::PopulateDesingBOQ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }
Example #2
0
 private void PrepareBOQSheetsInTab()
 {
     try
     {
         tabBOQSheets.Pages.Clear();
         foreach (SalesEnquiryDesignBOQSheet sheetModel in MODEL.SHEETS)
         {
             KryptonPage pageBOQSheet = new KryptonPage()
             {
                 Text = sheetModel.SheetName, Name = string.Format("page{0}", tabBOQSheets.Pages.Count + 1)
             };
             ControlSalesEnquiryDesignBOQSheet _sheetControl = new ControlSalesEnquiryDesignBOQSheet(sheetModel);
             pageBOQSheet.Controls.Add(_sheetControl);
             _sheetControl.Dock = DockStyle.Fill;
             tabBOQSheets.Pages.Add(pageBOQSheet);
             tabBOQSheets.SelectedPage = pageBOQSheet;
             _sheetControl.PopulateBOQItemsGrid();
             _sheetControl.Visible = true;
             _sheetControl.SetBOQItemsGridColumnSizes();
             _sheetControl.SetBOQItemsGridColumnSizes();
             _sheetControl.Refresh();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::PrepareBOQSheetsInTab", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        public void PopulateDesingBOQFromPreviousEnquiry(int prevEnquiryID)
        {
            MODEL = null;
            tabBOQSheets.Pages.Clear();
            try
            {
                MODEL = (new ServiceSalesEnquiryBOQ()).GetDesignBOQModelForSalesEnquiry(prevEnquiryID);
                if (MODEL != null) // DRAW ALL SHEETS
                {
                    MODEL.BOQ_ID     = 0;
                    MODEL.BOQ_NUMBER = (new ServiceSalesEnquiryBOQ()).GenerateDesignBOQNumber(SalesEnquiryID);
                    MODEL.ENQUIRY_ID = SalesEnquiryID;

                    foreach (SalesEnquiryDesignBOQSheet sheet in MODEL.SHEETS)
                    {
                        KryptonPage pageBOQSheet = new KryptonPage()
                        {
                            Text = sheet.SheetName, Name = string.Format("page{0}", tabBOQSheets.Pages.Count + 1)
                        };
                        ControlSalesEnquiryDesignBOQSheet _sheetControl = new ControlSalesEnquiryDesignBOQSheet(sheet);
                        pageBOQSheet.Controls.Add(_sheetControl);
                        _sheetControl.Dock = DockStyle.Fill;
                        tabBOQSheets.Pages.Add(pageBOQSheet);
                        _sheetControl.ParentTabPage = pageBOQSheet;
                        _sheetControl.PopulateBOQItemsGrid();
                        tabBOQSheets.SelectedPage = pageBOQSheet;
                        _sheetControl.Visible     = true;
                        //_sheetControl.SetBOQItemsGridColumnSizes();
                        _sheetControl.SetBOQItemsGridColumnSizes();
                    }
                }

                foreach (KryptonPage page in tabBOQSheets.Pages)
                {
                    ControlSalesEnquiryDesignBOQSheet sheet = (ControlSalesEnquiryDesignBOQSheet)page.Controls[0];
                    sheet.SetBOQItemsGridColumnSizes();
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::PopulateDesingBOQFromPreviousEnquiry", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void btnAddNewBOQSheet_sachin_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceSalesEnquiryBOQ serviceDesignBOQ = new ServiceSalesEnquiryBOQ();
                frmAddEditBOQDesign    frm = new frmAddEditBOQDesign();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    SalesEnquiryDesignBOQSheet newSheet = new SalesEnquiryDesignBOQSheet();
                    newSheet.SheetName    = frm.txtSheetName.Text;
                    newSheet.BOQ_SERVICES = frm.BOQ_SERVICES;
                    newSheet.BOQ_ITEMS    = frm.BOQ_ITEMS;
                    if (newSheet.datatableBOQ == null)
                    {
                        newSheet.datatableBOQ = serviceDesignBOQ.GenerateBOQDataTableDefault();
                    }

                    newSheet.datatableBOQ = serviceDesignBOQ.GenerateDesignBOQDataTableWithServices(newSheet.datatableBOQ, newSheet.BOQ_SERVICES, newSheet.BOQ_ITEMS);
                    MODEL.SHEETS.Add(newSheet);

                    KryptonPage pageBOQSheet = new KryptonPage()
                    {
                        Text = newSheet.SheetName, Name = string.Format("page{0}", tabBOQSheets.Pages.Count + 1)
                    };
                    ControlSalesEnquiryDesignBOQSheet _sheetControl = new ControlSalesEnquiryDesignBOQSheet(newSheet);
                    pageBOQSheet.Controls.Add(_sheetControl);
                    _sheetControl.Dock = DockStyle.Fill;
                    tabBOQSheets.Pages.Add(pageBOQSheet);
                    _sheetControl.PopulateBOQItemsGrid();
                    _sheetControl.SetBOQItemsGridColumnSizes();
                    tabBOQSheets.SelectedPage = pageBOQSheet;
                    _sheetControl.Visible     = true;

                    //PopulateBOQItemsGrid();
                    btnAddNewBOQSheet.Enabled = btnSaveBOQ.Enabled = ButtonEnabled.True;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::btnAddNewBOQSheetClick", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
 private void CreateDefaultBOQSheet()
 {
     try
     {
         MODEL = new SalesEnquiryDesignBOQViewModel();
         ServiceSalesEnquiryBOQ serviceDesignBOQ = new ServiceSalesEnquiryBOQ();
         MODEL.ENQUIRY_ID = this.SalesEnquiryID;
         SalesEnquiryDesignBOQSheet newSheet = new SalesEnquiryDesignBOQSheet();
         newSheet.SheetName        = "Default".ToUpper();
         newSheet.SheetDescription = string.Empty;
         newSheet.BOQ_SERVICES     = new BindingList <EnquiryBOQService>();
         newSheet.BOQ_ITEMS        = new BindingList <EnquiryBOQItem>();
         if (newSheet.datatableBOQ == null)
         {
             newSheet.datatableBOQ = serviceDesignBOQ.GenerateBOQDataTableDefault();
         }
         newSheet.datatableBOQ = serviceDesignBOQ.GenerateDesignBOQDataTableWithServices(newSheet.datatableBOQ, newSheet.BOQ_SERVICES, newSheet.BOQ_ITEMS);
         MODEL.SHEETS.Add(newSheet);
         KryptonPage pageBOQSheet = new KryptonPage()
         {
             Text = newSheet.SheetName, Name = string.Format("page{0}", tabBOQSheets.Pages.Count + 1)
         };
         ControlSalesEnquiryDesignBOQSheet _sheetControl = new ControlSalesEnquiryDesignBOQSheet(newSheet);
         pageBOQSheet.Controls.Add(_sheetControl);
         _sheetControl.ParentTabPage = pageBOQSheet;
         _sheetControl.Dock          = DockStyle.Fill;
         tabBOQSheets.Pages.Add(pageBOQSheet);
         _sheetControl.PopulateBOQItemsGrid();
         tabBOQSheets.SelectedPage = pageBOQSheet;
         _sheetControl.Visible     = true;
         _sheetControl.SetBOQItemsGridColumnSizes();
         if (!_ReadOnly)
         {
             btnAddNewBOQSheet.Enabled = btnSaveBOQ.Enabled = ButtonEnabled.True;
         }
         _sheetControl.ReadOnly = this.ReadOnly;
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
     }
 }