Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if(this.hasErrors()==false){
                Expenses ex = new Expenses();
                ex.setExpensesType(cboType.Text);
                ex.setDescription(txtDescription.Text);
                if (btnBrowse.Enabled)
                {
                    ex.setQuantity(double.Parse(txtQuantity.Text));
                }
                else {
                    ex.setQuantity(0);
                }
                ex.setAmount(double.Parse(txtAmount.Text));
                ex.setRemarks(txtRemarks.Text);

                if(this.active_expenses_id!=0){
                    ex.setIdExpenses(active_expenses_id);
                    ex.edit();
                }
                else{ex.Save();}
            }
            this.clearFields();
            fe.loadListviewItem();

            //save record for tindahan record automatically
            this.saveToTindahan();
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     Poultry.classes.Expenses ex = new Poultry.classes.Expenses();
      ex.Save();
      double i=GLOBAL_VARS.db.getLastId();
      MessageBox.Show(i.ToString());
 }
Ejemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     //idexpenses, description, amount, quantity, date_created, remarks, expenses_type
     Expenses updateExp;
     List<Expenses> expensesToUpdate = new List<Expenses>();
     foreach(ListViewItem lst in lsvNewMonth.Items){
         updateExp = new Expenses();
         updateExp.setIdExpenses(Convert.ToDouble(lst.Text));
         updateExp.setDescription(lst.SubItems[1].Text);
         updateExp.setAmount(Convert.ToDouble(lst.SubItems[2].Text));
         updateExp.setQuantity(Convert.ToDouble(lst.SubItems[3].Text));
         updateExp.setRemarks(lst.SubItems[5].Text);
         updateExp.setDateCreated(formatDate());
         updateExp.setExpensesType(lst.SubItems[6].Text);
         updateExp.Save();
         expensesToUpdate.Add(updateExp);
     }
     this.updateQtyOfPreviousExp(expensesToUpdate);
 }