コード例 #1
0
        private bool SaveBilltoDb(BillModel billToSave)
        {
            var repo          = new BillRepository();
            var convertedBill = ConvertProgramToDb.ConvertBill(billToSave);

            repo.AddBill(convertedBill);
            return(true);
        }
コード例 #2
0
        private bool SaveBilltoDb(IEnumerable <BillModel> billsToSave)
        {
            var repo           = new BillRepository();
            var convertedBills = ConvertProgramToDb.ConvertBill(billsToSave);

            repo.AddBill(convertedBills);
            return(true);
        }
コード例 #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentCell != null)
     {
         int at = dataGridView1.CurrentCell.RowIndex;
         billViews[at].PayDate = DateTime.Now.ToString();
         billRepository.AddBill(BillExtensionMethod.ConvertToBill(billViews[at]));
     }
 }
コード例 #4
0
        public void CreateNewBill(string username, BillViewModel model)
        {
            //get Employee
            EmployeeRepository employeerepo = new EmployeeRepository(_context);
            var employee = employeerepo.GetByEmpNo(username);
            var empId    = employee.Emp_ID;

            //Create Bill
            BillRepository billrepo = new BillRepository(_context);
            Bill           bill     = new Bill();

            bill.Bill_Status = model.BillStatus;
            bill.Emp_ID      = empId;

            billrepo.AddBill(bill);

            //Create Bill Details
            BillDetailRepository billdetailrepo = new BillDetailRepository(_context);
            Bill_Detail          billdetail     = new Bill_Detail()
            {
                Bill_Amount        = model.BillAmount,
                Bill_Date          = model.BillDate,
                Bill_ModeOfPayment = model.ModeOfPayment,
                Bill_Type          = model.BillType,
                Bill_ID            = bill.Bill_ID,
                Bill_have_SCopy    = (model.BillSCopy != null) ? true : false,
            };

            billdetailrepo.AddBillDetail(billdetail);

            //Add Scanned Copy
            if (billdetail.Bill_have_SCopy)
            {
                BillSCopyRepository bscopyrepo = new BillSCopyRepository(_context);
                Bill_SCopy          billscopy  = new Bill_SCopy()
                {
                    Bill_ID = bill.Bill_ID,
                    SCopy   = model.BillSCopy
                };
                bscopyrepo.AddBillSCopy(billscopy);
            }

            //Add Bill Manager
            //get Manager's EmpID

            String[] emp_no_name = model.Manager.Split('-');
            var      ManagerId   = employeerepo.GetByEmpNo(emp_no_name[0]).Emp_ID;

            BillMRepository bmrepo = new BillMRepository(_context);

            Bill_M billm = new Bill_M();

            billm.Bill_ID = bill.Bill_ID;
            billm.Emp_ID  = ManagerId;

            bmrepo.AddBillM(billm);
        }