Example #1
0
        //================================================================================================================================================//
        // QUOTE ADD LOAD FORM                                                                                                                            //
        //================================================================================================================================================//
        private void Q_Add_Load(object sender, EventArgs e)
        {
            Home frmHome = (Home)this.Owner;

            if (frmHome.GetCurPanel() == "pnl_L_Quotes")
            {
                Quotes curForm = (Quotes)frmHome.GetCurForm();
                txt_QA_CCode.Text = curForm.GetCCode();
                txt_QA_CName.Text = curForm.GetCName();
                dt = curForm.GetQuotes();
            }
            else
            {
                Int_Quotes curForm = (Int_Quotes)frmHome.GetCurForm();
                txt_QA_CCode.Text = curForm.GetCCode();
                txt_QA_CName.Text = curForm.GetCName();
                dt = curForm.GetQuotes();
            }

            int qNum = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr.RowState == DataRowState.Deleted)
                {
                    string str = dr["Quote_Number", DataRowVersion.Original].ToString().Trim();
                    int    pos = str.IndexOf("_");
                    int    x   = Convert.ToInt32(str.Remove(0, pos + 2));

                    if (x > qNum)
                    {
                        qNum = x;
                    }
                }
                else
                {
                    string str = dr["Quote_Number"].ToString().Trim();
                    int    pos = str.IndexOf("_");
                    int    x   = Convert.ToInt32(str.Remove(0, pos + 2));
                    if (x > qNum)
                    {
                        qNum = x;
                    }
                }
            }
            txt_QA_QNum.Text = txt_QA_CCode.Text + "_Q" + (qNum + 1).ToString("000");
            txt_QA_Desc.Focus();
        }
        //================================================================================================================================================//
        // QUOTE EDIT DELETE FORM                                                                                                                         //
        //================================================================================================================================================//
        private void Q_Edit_Del_Load(object sender, EventArgs e)
        {
            Home frmHome = (Home)this.Owner;

            if (frmHome.GetCurPanel() == "pnl_L_Quotes")
            {
                Quotes curForm = (Quotes)frmHome.GetCurForm();
                dt                 = curForm.GetQuotes();
                SELECTED_QUOTE     = curForm.GetSelectedQuote();
                txt_QED_CCode.Text = curForm.GetCCode();
                txt_QED_CName.Text = curForm.GetCName();
            }
            else
            {
                Int_Quotes curForm = (Int_Quotes)frmHome.GetCurForm();
                dt                 = curForm.GetQuotes();
                SELECTED_QUOTE     = curForm.GetSelectedQuote();
                txt_QED_CCode.Text = curForm.GetCCode();
                txt_QED_CName.Text = curForm.GetCName();
            }
            LoadQuote();
        }