// Below this method is used when user clicks add button creating an instance of the sale. // The if loop checks to see if the method is null and if not null the method adds the sale to the sale listbox. private void btnAdd_Click(object sender, System.EventArgs e) { frmNewSale newSaleForm = new frmNewSale(); Sale sale = newSaleForm.GetNewSale(); if (sale != null) { sales.Add(sale); SaleDB.SaveSales(sales); FillSaleListBox(); } }
//Below this method is used when user clicks delete button, a confirmation dialog is displayed. // If user confirms the sale is removed from the sale list. 2 if loops are used. private void btnDelete_Click(object sender, System.EventArgs e) { int i = lstSales.SelectedIndex; if (i != -1) { Sale sale = (Sale)sales[i]; string message = "Are you sure you want to delete " + sale.Description + "?"; DialogResult button = MessageBox.Show(message, "Confirm Delete", MessageBoxButtons.YesNo); if (button == DialogResult.Yes) { sales.Remove(sale); SaleDB.SaveSales(sales); FillSaleListBox(); } } }
private void initConfig() { iniFile = new IniFile(Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini"); initC = new InitConfig(); //regE = new RegEdit(); //MessageBox.Show("aaa " + Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini", "LottoryControl StatusServer" + initC.StatusServer.ToLower()); GetConfig(); //MessageBox.Show("bbb", "LottoryControl"); cf = new Config1(); //MessageBox.Show("ccc", "LottoryControl"); conn = new ConnectDB(initC); ratedb = new RateDB(conn); saledb = new SaleDB(conn); sfdb = new StaffDB(conn); thodb = new ThooDB(conn); lotdb = new LottoDB(conn); rwdb = new RewardDB(conn); fldb = new FlockDB(conn); srdb = new SaleRateDB(conn); cudb = new CustomerDB(conn); imgdb = new ImageDB(conn); nldb = new NumberLimitDB(conn); //MessageBox.Show("ddd", "LottoryControl"); rate = new Rate(); sale = new Sale(); staff = new Staff(); tho = new Thoo(); lot = new Lotto(); rw = new Reward(); fl = new FLock(); sr = new SaleRate(); cu = new Customer(); img = new Image1(); nl = new NumberLimit(); r2Down = new Rate(); r2Tod = new Rate(); r2Up = new Rate(); r3Up = new Rate(); r3Tod = new Rate(); r3Down = new Rate(); rUp = new Rate(); rDown = new Rate(); //MessageBox.Show("bbb", "LottoryControl"); rUp = ratedb.selectByPk("up"); rDown = ratedb.selectByPk("down"); r3Up = ratedb.selectByPk("3up"); r3Tod = ratedb.selectByPk("3tod"); r3Down = ratedb.selectByPk("3down"); r2Down = ratedb.selectByPk("2down"); r2Up = ratedb.selectByPk("2up"); lTho = thodb.setData(); setThoColor(); lsr = srdb.selectSRAll(); ls = saledb.selectSAll(); lnl = selectByNumberLimit(); //cboThoo = new ComboBox(); cbosf = new ComboBox(); //cboSale = new ComboBox(); //cboThoo = thodb.getCboThoo(cboThoo); cbosf = sfdb.getCboStaff(cbosf); //cboSale = saledb.getCboSale(cboSale); }
public List <Search> ReadSaleByUserId(int userId) { return(SaleDB.ReadSaleByUserId(userId)); }
public bool AddSale(Sale sale) { return(SaleDB.AddSale(sale)); }
private SalesManager() { SDB = new SaleDB(configuration.DB_MODE); sales = SDB.Get(); saleId = currSaleIndex(); }
//Below GetSales method of SaleDB is called to fill sales into the list box. frmNewSaleManager_load is a load event handler for this class. private void frmNewSaleManager_Load(object sender, System.EventArgs e) { sales = SaleDB.GetSales(); FillSaleListBox(); }