private void WithoutBarcodeChkBox_CheckedChanged(object sender, EventArgs e) { if (WithoutBarcodeChkBox.Checked) { BarcodeToEditTxtBox.Clear(); BarcodeToEditTxtBox.Enabled = false; ItemDescriptionComboBox.Enabled = false; WithoutBarcodeComboBox.Enabled = true; ByBarcDescChkBox.Enabled = false; BarcodeTxtBox.Enabled = false; BarcodeTxtBox.Clear(); if (IsUpdating) { return; } UpdateItemBtn.Hide(); } else { BarcodeToEditTxtBox.Enabled = true; ItemDescriptionComboBox.Enabled = false; WithoutBarcodeComboBox.Enabled = false; ByBarcDescChkBox.Enabled = true; ByBarcDescChkBox.Checked = true; BarcodeTxtBox.Enabled = Enabled; if (IsUpdating) { return; } BarcodeTxtBox.Clear(); UpdateItemBtn.Hide(); } }
private void ByBarcDescChkBox_CheckedChanged(object sender, EventArgs e) { if (ByBarcDescChkBox.Checked) { BarcodeToEditTxtBox.Enabled = true; ItemDescriptionComboBox.Enabled = false; if (IsUpdating) { return; } UpdateItemBtn.Hide(); } else { BarcodeToEditTxtBox.Enabled = false; ItemDescriptionComboBox.Enabled = true; if (IsUpdating) { return; } UpdateItemBtn.Hide(); // ItemDescriptionComboBox.SelectedIndex = 0; } }
private void BarcodeToEditTxtBox_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == (int)Keys.Return) { IsUpdating = true; if (Validators.TxtBoxNotEmpty(BarcodeToEditTxtBox.Text)) { aItemData = ItemsMgmt.SelectItemByBarCode(BarcodeToEditTxtBox.Text); if (aItemData != null) { if (aItemData.Rows.Count > 0) { UpdateItemBtn.Show(); TypeComboBox.Text = ItemTypeMgmt.SelectItemTypeByID(int.Parse(aItemData.Rows[0]["Type"].ToString())); CategoryComboBox.Text = ItemCategoryMgmt.SelectItemCategoryByID(int.Parse(aItemData.Rows[0]["Category"].ToString())); VendorComboBox.Text = VendorsMgmt.SelectVendorByID(int.Parse(aItemData.Rows[0]["Vendor"].ToString())); TaxLevelComboBox.Text = ItemTaxLevelMgmt.SelectItemTaxByID(int.Parse(aItemData.Rows[0]["TaxLevel"].ToString())); BarcodeTxtBox.Text = BarcodeToEditTxtBox.Text; DescriptionTxtBox.Text = aItemData.Rows[0]["Description"].ToString(); ItemDescriptionComboBox.Text = aItemData.Rows[0]["Description"].ToString(); QtyTxtBox.Text = aItemData.Rows[0]["Qty"].ToString(); RenderPointTxtBox.Text = aItemData.Rows[0]["RenderPoint"].ToString(); DateAddedTxtBox.Text = aItemData.Rows[0]["EntryDate"].ToString(); SellPriceTxtBox.Text = aItemData.Rows[0]["SellPrice"].ToString(); AvgCostTxtBox.Text = aItemData.Rows[0]["AvgUnitCost"].ToString(); AvailableQtyTxtBox.Text = aItemData.Rows[0]["OnHandQty"].ToString(); /*@SMS V01O changed*/ Pricing.Controls.Clear(); //ADDING PRICE LEVELS int ItemID = int.Parse(aItemData.Rows[0]["ID"].ToString()); aPriceLevelsTable = PriceLevelsMgmt.SelectAll(); 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(); DataTable aSpecialPriceTable = SpecialPricesMgmt.SelectSpecialPricebyItemIDandPriceLevelID(ItemID, int.Parse(r["ID"].ToString())); 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.BarcodeTxt + "\n2)" + MsgTxt.IfNotBarChkWithoutBarcodeTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(MsgTxt.NotUsedTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { UpdateItemBtn.Hide(); } TaxEnclodedChkBox.Checked = false; UpdateMargin(); IsUpdating = false; } catch (Exception ex) { IsUpdating = false; MessageBox.Show(MsgTxt.UnexpectedError + "\nException: IN[BarcodeToEditTxtBox_KeyPress] \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); throw; } }