public void NotificationOfApproval(Int64 bill_ID) { NotificationRepository ntf = new NotificationRepository(_context); Bill bill = new Bill(); bill = _context.Bills.Find(bill_ID); Notification _ntf = new Notification() { Emp_ID = bill.Emp_ID, Seen = false, Ntf_Body = "Bill Number " + bill.Bill_ID.ToString() + " has been approved", Ntf_Subject = "Approval of Bill", TimeStamp = DateTime.Now }; ntf.AddNotification(_ntf); Bill_FM bill_fm = new Bill_FM(); BillFMRepository bfm = new BillFMRepository(_context); bill_fm = bfm.GetByBillId(bill_ID); _ntf = new Notification(); _ntf.Emp_ID = bill_fm.Bill_FM_ID; _ntf.Ntf_Body = "New bill for financing has arrived"; _ntf.Ntf_Subject = "New Bill"; _ntf.TimeStamp = DateTime.Now; ntf.AddNotification(_ntf); return; }
public BillViewModel getBillDetail(Int64 id) { BillRepository billrepo = new BillRepository(_context); BillDetailRepository billdetailrepo = new BillDetailRepository(_context); BillMRepository billmrepo = new BillMRepository(_context); BillFMRepository billfmrepo = new BillFMRepository(_context); BillSCopyRepository billscopyrepo = new BillSCopyRepository(_context); BillViewModel bvm = new BillViewModel(); Bill bill = billrepo.GetByBillID(id); Bill_Detail billdetail = billdetailrepo.GetByBillID(id); Bill_M billmanager = billmrepo.GetByBillID(id); Bill_FM billfmanager = null; Bill_SCopy billscopy = null; if (bill.Bill_Status == ApricotEnums.BillSatusEnum.APPROVED || bill.Bill_Status == ApricotEnums.BillSatusEnum.CLOSED) { billfmanager = billfmrepo.GetByBillId(id); } if (billdetail.Bill_have_SCopy) { billscopy = billscopyrepo.GetByBillID(id); } bvm.BillID = bill.Bill_ID; bvm.BillStatus = bill.Bill_Status; bvm.BillAmount = billdetail.Bill_Amount; bvm.BillDate = billdetail.Bill_Date; bvm.BillSCopy = null; bvm.BillType = billdetail.Bill_Type; bvm.FManager = (billfmanager != null) ? billfmanager.FinanceManager.Emp_No : "Not Aviablable"; bvm.Manager = billmanager.Manager.Emp_Name; bvm.ModeOfPayment = billdetail.Bill_ModeOfPayment; return(bvm); }