示例#1
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);
            }
        }
        private void btnUpdateSheet_Click(object sender, EventArgs e)
        {
            ServiceSalesEnquiryBOQ serviceDesignBOQ = new ServiceSalesEnquiryBOQ();

            try
            {
                frmAddEditBOQDesign frm = new frmAddEditBOQDesign();
                frm.txtSheetName.Text = BOQSheet.SheetName;
                frm.BOQ_ITEMS         = BOQSheet.BOQ_ITEMS;
                frm.BOQ_SERVICES      = BOQSheet.BOQ_SERVICES;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (ParentTabPage != null)
                    {
                        ParentTabPage.Text = frm.txtSheetName.Text.Trim();
                    }
                    BOQSheet.SheetName    = frm.txtSheetName.Text.Trim();
                    BOQSheet.BOQ_SERVICES = frm.BOQ_SERVICES;
                    BOQSheet.BOQ_ITEMS    = frm.BOQ_ITEMS;

                    if (BOQSheet.datatableBOQ.Rows.Count == 0)
                    {
                        BOQSheet.datatableBOQ = serviceDesignBOQ.GenerateBOQDataTableDefault();
                    }

                    BOQSheet.datatableBOQ = serviceDesignBOQ.GenerateDesignBOQDataTableWithServices(BOQSheet.datatableBOQ, BOQSheet.BOQ_SERVICES, BOQSheet.BOQ_ITEMS);
                    PopulateBOQItemsGrid();
                    this.Cursor = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::btnUpdateSheet_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void btnCreateNewBOQ_Click(object sender, EventArgs e)
 {
     try
     {
         ServiceSalesEnquiryBOQ serviceDesignBOQ = new ServiceSalesEnquiryBOQ();
         frmAddEditBOQDesign    frm = new frmAddEditBOQDesign();
         if (frm.ShowDialog() == DialogResult.OK)
         {
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "ControlSalesEnquiryDesignBOQ::btnCreateNewBOQ_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }