private void UpdateBtnLbl_Click(object sender, EventArgs e) { int aBarcodeLength = 0; int aDivisionscale = 0; if (int.TryParse(BarcodeLengthTxtBox.Text, out aBarcodeLength) && int.TryParse(DivisionScaleTxtBox.Text, out aDivisionscale)) { Weight aWeight = new Weight(); aWeight.DivisionScale = aDivisionscale; aWeight.BarcodeLength = aBarcodeLength; if (WeightMgmt.UpdateWeight(aWeight)) { MessageBox.Show(MsgTxt.UpdateSuccessfully, MsgTxt.UpdateSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(MsgTxt.UnexpectedError + " " + "DB-ERROR: Cannot UpdateWeight", MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show(MsgTxt.PleaseSelectCorrectAmountTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); if (!int.TryParse(BarcodeLengthTxtBox.Text, out aBarcodeLength)) { BarcodeLengthTxtBox.Focus(); } else { DivisionScaleTxtBox.Focus(); } } }
public DisposeItems() { InitializeComponent(); TranslateUI(); try { DataRow aWeightRow = WeightMgmt.SelectWeightRow(); if (int.TryParse(aWeightRow["DivisionScale"].ToString(), out DivisionScale) && int.TryParse(aWeightRow["BarcodeLength"].ToString(), out BarcodeLength) ) { aThereIsWeigth = true; } } catch (Exception ex) { MessageBox.Show("ERROR LOADING WEIGTH"); } }
public WeightConfig() { InitializeComponent(); aWeightrow = WeightMgmt.SelectWeightRow(); BarcodeLengthTxtBox.Text = aWeightrow["BarcodeLength"].ToString(); DivisionScaleTxtBox.Text = aWeightrow["DivisionScale"].ToString(); ExitPB.Click += new EventHandler(Validators.ExitPBOnClick); ExitPB.MouseHover += new EventHandler(Validators.ExitAndMinimizeMouseHover); ExitPB.MouseLeave += new EventHandler(Validators.ExitAndMinimizeMouseLeave); MinimizePB.Click += new EventHandler(Validators.MinimizePBOnClick); MinimizePB.MouseHover += new EventHandler(Validators.ExitAndMinimizeMouseHover); MinimizePB.MouseLeave += new EventHandler(Validators.ExitAndMinimizeMouseLeave); //Add this Line To Each Constructor To Disable Maximize this.StartPosition = FormStartPosition.CenterScreen; }
private void AddNewItem_Load(object sender, EventArgs e) { try { // AvgCostTxtBox.BackColor = Color.Transparent; this.WindowState = FormWindowState.Maximized; // TODO: This line of code loads data into the 'dBDataSet.Items' table. You can move, or remove it, as needed. this.itemsTableAdapter.Fill(this.dBDataSet.Items); // TODO: This line of code loads data into the 'dBDataSet.TaxLevel' table. You can move, or remove it, as needed. this.taxLevelTableAdapter.Fill(this.dBDataSet.TaxLevel); // TODO: This line of code loads data into the 'dBDataSet.Vendors' table. You can move, or remove it, as needed. this.vendorsTableAdapter.Fill(this.dBDataSet.Vendors); // TODO: This line of code loads data into the 'dBDataSet.ItemCategory' table. You can move, or remove it, as needed. this.itemCategoryTableAdapter.Fill(this.dBDataSet.ItemCategory); // TODO: This line of code loads data into the 'dBDataSet.ItemType' table. You can move, or remove it, as needed. this.itemTypeTableAdapter.Fill(this.dBDataSet.ItemType); aPriceLevelsTable = PriceLevelsMgmt.SelectAll(); if (aPriceLevelsTable != null) { 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); } } } } else { MessageBox.Show(MsgTxt.ErrorLoadingFrom + "\n" + MsgTxt.CannotFindTxt + " " + MsgTxt.PriceLevelsTxt + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } DataRow aWeightRow = WeightMgmt.SelectWeightRow(); if (aWeightRow != null) { if (int.TryParse(aWeightRow["DivisionScale"].ToString(), out DivisionScale) && int.TryParse(aWeightRow["BarcodeLength"].ToString(), out BarcodeLength)) { if (DivisionScale > 0 && BarcodeLength > 0) { aThereIsWeigth = true; } } } else { //show error or no ? } } catch (Exception ex) //Launching Error Please Report It To Sari King [Database error 99%] { MessageBox.Show(MsgTxt.ErrorLoadingFrom + "\nException: IN[AddNewItem_Load] \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }