Пример #1
0
        private void Q_Add_Load(object sender, EventArgs e)
        {
            if (this.Owner.GetType() == typeof(Quotes))
            {
                Quotes owner = (Quotes)this.Owner;
                txt_QA_CCode.Text = owner.GetClientCode();
                txt_QA_CName.Text = owner.GetClientName();
                dt = owner.GetQuotes();
            }
            else
            {
                Int_Quotes owner = (Int_Quotes)this.Owner;
                txt_QA_CCode.Text = owner.GetClientCode();
                txt_QA_CName.Text = owner.GetClientName();
                dt = owner.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();
        }
Пример #2
0
        private void Q_Edit_Del_Load(object sender, EventArgs e)
        {
            if (this.Owner.GetType() == typeof(Quotes))
            {
                Quotes owner = (Quotes)this.Owner;

                dt                 = owner.GetQuotes();
                SELECTED_QUOTE     = owner.GetSelectedQuote();
                txt_QED_CCode.Text = owner.GetClientCode();
                txt_QED_CName.Text = owner.GetClientName();
            }
            else
            {
                Int_Quotes owner = (Int_Quotes)this.Owner;

                dt                 = owner.GetQuotes();
                SELECTED_QUOTE     = owner.GetSelectedQuote();
                txt_QED_CCode.Text = owner.GetClientCode();
                txt_QED_CName.Text = owner.GetClientName();
            }
            LoadQuote();
        }