示例#1
0
 private void AddNewPriceLevelBtn_Click(object sender, EventArgs e)
 {
     try
     {
         AddNewPriceLevel aAddNewPriceLevel = new AddNewPriceLevel();
         aAddNewPriceLevel.ShowDialog();
         aPriceLevelsTable = PriceLevelsMgmt.SelectAll();
         Pricing.Controls.Clear();
         if (aPriceLevelsTable.Rows.Count > 0)
         {
             foreach (DataRow r in aPriceLevelsTable.Rows)
             {
                 if (r["Name"].ToString() != "Standard")
                 {
                     Label aLabel = new Label();
                     aLabel.Text = r["Name"].ToString();
                     TextBox aTextBox = new TextBox();
                     aTextBox.Text         = SellPriceTxtBox.Text;
                     aTextBox.Name         = r["Name"].ToString();
                     aTextBox.TextChanged += new EventHandler(Calcium_RMS.Validators.TextBoxDoubleInputChange);
                     Pricing.Controls.Add(aLabel);
                     Pricing.Controls.Add(aTextBox);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(MsgTxt.UnexpectedError + "\nException: IN[AddNewPriceLevelBtn_Click] \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
示例#2
0
        private void AddNewPriceLevelBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (aItemData != null)
                {
                    AddNewPriceLevel aAddNewPriceLevel = new AddNewPriceLevel();
                    aAddNewPriceLevel.ShowDialog();

                    aPriceLevelsTable = PriceLevelsMgmt.SelectAll();
                    Pricing.Controls.Clear();
                    if (aPriceLevelsTable.Rows.Count > 0)
                    {
                        int ItemID = int.Parse(aItemData.Rows[0]["ID"].ToString());
                        foreach (DataRow r in aPriceLevelsTable.Rows)
                        {
                            if (r["Name"].ToString() != "Standard")
                            {
                                Label aLabel = new Label();
                                aLabel.Text = r["Name"].ToString();
                                TextBox   aTextBox           = new TextBox();
                                DataTable aSpecialPriceTable = SpecialPricesMgmt.SelectSpecialPricebyItemIDandPriceLevelID(ItemID, int.Parse(r["ID"].ToString()));
                                if (aSpecialPriceTable == null)
                                {
                                    MessageBox.Show("UNEXPECTED ERROR");
                                    this.Close();
                                }
                                if (aSpecialPriceTable.Rows.Count > 0)
                                {
                                    aTextBox.Text = aSpecialPriceTable.Rows[0]["Price"].ToString();
                                }
                                else
                                {
                                    aTextBox.Text = SellPriceTxtBox.Text;
                                }
                                aTextBox.Name         = r["Name"].ToString();
                                aTextBox.TextChanged += new EventHandler(Calcium_RMS.Validators.TextBoxDoubleInputChange);
                                Pricing.Controls.Add(aLabel);
                                Pricing.Controls.Add(aTextBox);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(MsgTxt.PleaseSelectTxt + "\n1)" + MsgTxt.ItemTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\nException: IN[AddNewPriceLevelBtn_Click] \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }