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(); } }
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); } }
private void WithoutBarcodeComboBox_SelectedIndexChanged(object sender, EventArgs e) { try { if (IsUpdating) { return; } if (WithoutBarcodeComboBox.SelectedValue != null) { aItemData = ItemsMgmt.SelectItemByBarCode(WithoutBarcodeComboBox.SelectedValue.ToString()); } else { return; } if (aItemData.Rows.Count > 0) { IsUpdating = true; 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 = aItemData.Rows[0]["Barcode"].ToString(); DescriptionTxtBox.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(); aLabel.ForeColor = Color.Black; 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.NotUsedTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } TaxEnclodedChkBox.Checked = false; UpdateMargin(); IsUpdating = false; } catch (Exception ex) { IsUpdating = false; MessageBox.Show(MsgTxt.UnexpectedError + "\nException: IN[WithoutBarcodeComboBox_SelectedIndexChanged] \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private void ListBillsBtn_Click(object sender, EventArgs e) { try { int FilterCustomerID = -1; if (CustomerNameChkBox.Checked) { FilterCustomerID = CustomerMgmt.SelectCustomerIDByPhone1(CustomerPhoneTxtBox.Text); if (FilterCustomerID == -1) { MessageBox.Show("Customer Not Found"); } } aCustomerTable = CustomerMgmt.SelectAllCustomers(); aCurrencyTable = CurrencyMgmt.SelectAll(); aUsersTable = UsersMgmt.SelectAllUsers(); aAccountsTable = AccountsMgmt.SelectAll(); aPriceLevelTable = PriceLevelsMgmt.SelectAll(); aPaymentMethodTable = PaymentMethodMgmt.SelectAll(); ListBillsDGView.Rows.Clear(); int FilterTellerNameID = 0; if (TellerNameChkBox.Checked && TellerNameComboBox.SelectedValue != null) { FilterTellerNameID = int.Parse(TellerNameComboBox.SelectedValue.ToString()); } string FilterDateFrom = ""; string FilterDateTo = ""; if (DateCheckBox.Checked) { FilterDateFrom = DateFrompicker.Value.ToShortDateString(); FilterDateTo = DateToPicker.Value.ToShortDateString(); } bool FilterCheckedBills = CkeckedBillsChkBox.Checked; bool FilterIsRevised = IsRevisedChkBox.Checked; bool FilterUnCheckedBills = UncheckedBillChkBox.Checked; bool FilterUnRevisedBills = UnRevisedChkBox.Checked; bool FilterCashCreditBills = CreditBillsChkBox.Checked; aBillTable = BillGeneralMgmt.SelectAllBills(FilterTellerNameID, FilterDateFrom, FilterDateTo, FilterCheckedBills, FilterIsRevised, FilterUnCheckedBills, FilterUnRevisedBills, FilterCustomerID, FilterCashCreditBills); if (aBillTable == null) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBillsBtn_Click:DB-ERROR aBillTable=null] \n \n", MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TotalITemsTxtBox.Text = aBillTable.Rows.Count.ToString(); if (aBillTable.Rows.Count > 0) { RowNum = 0; if (ListBillsDGView.Rows.Count < ItemsPerPage) { //TestingFor Paging pagesnumber = (int)aBillTable.Rows.Count / ItemsPerPage; if ((double.Parse(aBillTable.Rows.Count.ToString()) / ItemsPerPage - int.Parse(aBillTable.Rows.Count.ToString()) / ItemsPerPage) > 0) { pagesnumber++; } foreach (DataRow r in aBillTable.Rows) { if (ListBillsDGView.Rows.Count < ItemsPerPage) { ListBillsDGView.Rows.Add(); ListBillsDGView.Rows[RowNum].Cells["Number"].Value = aBillTable.Rows[RowNum]["Number"].ToString(); ListBillsDGView.Rows[RowNum].Cells["Date"].Value = aBillTable.Rows[RowNum]["Date"].ToString(); ListBillsDGView.Rows[RowNum].Cells["BillTime"].Value = aBillTable.Rows[RowNum]["BillTime"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalItems"].Value = aBillTable.Rows[RowNum]["TotalItems"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalTax"].Value = aBillTable.Rows[RowNum]["TotalTax"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalPrice"].Value = aBillTable.Rows[RowNum]["TotalPrice"].ToString(); for (int i = 0; i < aUsersTable.Rows.Count; i++) { if (int.Parse(aUsersTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["TellerID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["TellerID"].Value = aUsersTable.Rows[i]["UserName"].ToString();//aBillTable.Rows[RowNum]["TellerID"].ToString(); break; } } for (int i = 0; i < aCustomerTable.Rows.Count; i++) { if (int.Parse(aCustomerTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["CustomerID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["CustomerID"].Value = aCustomerTable.Rows[i]["Name"].ToString(); break; } } for (int i = 0; i < aPriceLevelTable.Rows.Count; i++) { if (int.Parse(aPriceLevelTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["PriceLevelID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["PriceLevelID"].Value = aPriceLevelTable.Rows[i]["Name"].ToString(); break; } } for (int i = 0; i < aPaymentMethodTable.Rows.Count; i++) { if (int.Parse(aPaymentMethodTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["PaymentMethodID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["PaymentMethodID"].Value = aPaymentMethodTable.Rows[i]["Name"].ToString(); break; } } ListBillsDGView.Rows[RowNum].Cells["TotalCost"].Value = aBillTable.Rows[RowNum]["TotalCost"].ToString(); ListBillsDGView.Rows[RowNum].Cells["Comments"].Value = aBillTable.Rows[RowNum]["Comments"].ToString(); ListBillsDGView.Rows[RowNum].Cells["SalesDiscount"].Value = aBillTable.Rows[RowNum]["SalesDiscount"].ToString(); ListBillsDGView.Rows[RowNum].Cells["DiscountPerc"].Value = aBillTable.Rows[RowNum]["DiscountPerc"].ToString(); ListBillsDGView.Rows[RowNum].Cells["CashIn"].Value = aBillTable.Rows[RowNum]["CashIn"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalDiscount"].Value = aBillTable.Rows[RowNum]["TotalDiscount"].ToString(); if (aBillTable.Rows[RowNum]["IsChecked"].ToString() == "0") { ListBillsDGView.Rows[RowNum].Cells["IsChecked"].Value = UiText.NoTxt; } else { ListBillsDGView.Rows[RowNum].Cells["IsChecked"].Value = UiText.YesTxt; } if (aBillTable.Rows[RowNum]["IsRevised"].ToString() == "0") { ListBillsDGView.Rows[RowNum].Cells["IsRevised"].Value = UiText.NoTxt; } else { ListBillsDGView.Rows[RowNum].Cells["IsRevised"].Value = UiText.YesTxt; } ListBillsDGView.Rows[RowNum].Cells["CheckedDate"].Value = aBillTable.Rows[RowNum]["CheckedDate"].ToString(); ListBillsDGView.Rows[RowNum].Cells["CheckedBy"].Value = aBillTable.Rows[RowNum]["CheckedBy"].ToString(); ListBillsDGView.Rows[RowNum].Cells["ReviseDate"].Value = aBillTable.Rows[RowNum]["ReviseDate"].ToString(); ListBillsDGView.Rows[RowNum].Cells["RevisedBy"].Value = aBillTable.Rows[RowNum]["RevisedBy"].ToString(); ListBillsDGView.Rows[RowNum].Cells["ReviseLoss"].Value = aBillTable.Rows[RowNum]["ReviseLoss"].ToString(); RowNum++; } } PageOfTotalTxtBox.Text = "1/" + pagesnumber.ToString(); currentpage = 1; } } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBillsBtn_Click] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
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(); } }