// 把Account封装成AccountList public List <AccountViewModel> AccountSealed(List <Account> accounts) { List <AccountViewModel> actViewModels = new List <AccountViewModel>(); AccountBusinessLayer actBal = new AccountBusinessLayer(); foreach (Account act in accounts) { AccountViewModel actViewModel = new AccountViewModel(); actViewModel.AccountID = act.AccountID; actViewModel.UserID = act.UserID; actViewModel.Genre = actBal.SearchType(act.GenreID); actViewModel.Classes = actBal.SearchClass(act.ClassesID); actViewModel.Money = act.Money.ToString("C"); actViewModel.Date = act.Date.ToString("yyyy-MM-dd"); actViewModel.Remark = act.Remark; if (actViewModel.Genre == "收入") { actViewModel.TypeColor = "green"; } else { actViewModel.TypeColor = "red"; } actViewModels.Add(actViewModel); } return(actViewModels); }
public ActionResult SearchAccountListByType(int GenreID, int ClassesID) { AccountListViewModel accountListViewModel = new AccountListViewModel(); AccountBusinessLayer actBal = new AccountBusinessLayer(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); List <Account> accounts = new List <Account>(); if (ClassesID != 0) { accounts = actBal.SearchList(int.Parse(s), GenreID, ClassesID); } else { accounts = actBal.SearchList(int.Parse(s), GenreID); } accountListViewModel.Accounts = AccountSealed(accounts); accountListViewModel.Today = DateTime.Today.ToString("yyyy-MM-dd"); List <Genre> types = actBal.GetTypeList();//从数据库中获取数据 ViewBag.ListTypes = types; return(View("AccountList", accountListViewModel)); }
//[ActionName("AccountView")] public ActionResult AccountView() { try { ViewData["Message"] = " "; AccountBusinessLayer accBL = new AccountBusinessLayer(); AccountModel accModel = new AccountModel(); UpdateModel(accModel); accBL.InsertAccData(accModel.account_number, accModel.bank_name, accModel.account_holder_name, accModel.isfc, accModel.mode_of_transfer, accModel.applicant_id, accModel.loan_id); //Session["bname"] = buModel.business_name; ViewData["Message"] = "Account Data is submitted Successfully"; return(RedirectToRoute(new { controller = "Beneficiary", action = "BeneficiaryOwnerView", bid = Session["bid"] })); //return View(buModel); } catch { ViewData["Message"] = "Processing Failed"; AccountDataAccess.sqlcon.Close(); return(View()); } }
public ActionResult AccountView(string bid) { AccountBusinessLayer accBl = new AccountBusinessLayer(); AccountModel accModel = accBl.GetAccdata(bid); return(View(accModel)); }
//GET :ID public ActionResult Details(int id) { var accBusObj = new AccountBusinessLayer(); var accModel = new AccountModel(); SqlDataReader sdr = accBusObj.GetAccountDetail(id); if (sdr.Read()) { Session["Accountno"] = Convert.ToInt64(sdr["account_no"]); Session["Balance"] = Convert.ToInt64(sdr["balance"]); accModel.AccountNo = Convert.ToInt64(sdr["account_no"]); accModel.DebitCardNo = Convert.ToInt64(sdr["debit_card_no"]); accModel.BranchId = sdr["branch_id"].ToString(); accModel.AccountTypeId = Convert.ToInt32(sdr["account_type_id"]); accModel.CheckBookId = sdr["check_book_id"].ToString(); accModel.CustomerId = Convert.ToInt32(sdr["customer_id"]); accModel.Balance = Convert.ToInt64(sdr["balance"]); } else { ViewData["Error"] = "Error"; } AccountDataAccess.sqlCon.Close(); return(View(accModel)); }
public ActionResult AddAccount() { BaseViewModel bvm = new BaseViewModel(); AccountBusinessLayer actBal = new AccountBusinessLayer(); List <Genre> types = actBal.GetTypeList();//从数据库中获取数据 ViewBag.ListTypes = types; return(View("AddAccount", bvm)); }
//GET :ID public ActionResult Details(int id) { var accBusObj = new AccountBusinessLayer(); AccountModel accModel = accBusObj.GetAccountDetail(id); Session["Accountno"] = accBusObj.AccountNo; Session["Balance"] = accBusObj.Balance; return(View(accModel)); }
// 删除某一项 public ActionResult Delete(int id) { AccountBusinessLayer actBal = new AccountBusinessLayer(); FinancialERPDAL db = new FinancialERPDAL(); var delItem = db.Accounts.FirstOrDefault(m => m.AccountID == id); if (delItem != null) { db.Accounts.Remove(delItem); db.SaveChanges(); } return(RedirectToAction("Accounting")); }
public ActionResult SaveEdit(Account a, String BtnSubmit) { switch (BtnSubmit) { case "保存": AccountBusinessLayer accBal = new AccountBusinessLayer(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); a.UserID = int.Parse(s); accBal.EditItem(a); return(RedirectToAction("Accounting")); case "取消": return(RedirectToAction("Accounting")); } return(new EmptyResult()); }
public ActionResult SearchAccountListByMonth(DateTime date1, DateTime date2) { AccountListViewModel accountListViewModel = new AccountListViewModel(); AccountBusinessLayer actBal = new AccountBusinessLayer(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); List <Account> accounts = actBal.SearchList(int.Parse(s), date1, date2); accountListViewModel.Accounts = AccountSealed(accounts); accountListViewModel.Today = DateTime.Today.ToString("yyyy-MM-dd"); List <Genre> types = actBal.GetTypeList();//从数据库中获取数据 ViewBag.ListTypes = types; return(View("AccountList", accountListViewModel)); }
public JsonResult GetAllClassByGenreID(int id) { AccountBusinessLayer abl = new AccountBusinessLayer(); List <Classes> lstClasses = new List <Classes>(); Classes c = new Classes(); c.ClassesID = 0; c.GenreID = 0; c.Cname = "全部分类"; if (id != 0) { lstClasses = abl.GetClassList(id); } lstClasses.Insert(0, c); return(Json(lstClasses, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { EditViewModel evm = new EditViewModel(); AccountBusinessLayer actBal = new AccountBusinessLayer(); Account a = new Account(); a = actBal.SearchListItem(id); evm.AccountID = a.AccountID; evm.GenreID = a.GenreID; evm.ClassesID = a.ClassesID; evm.Money = a.Money; evm.Date = a.Date.ToString("yyyy-MM-dd"); evm.Remark = a.Remark; evm.ClassIndex = actBal.GetClassIndex(a.GenreID, a.ClassesID) + 1; List <Genre> types = actBal.GetTypeList();//从数据库中获取数据 ViewBag.ListTypes = types; return(View("Edit", evm)); }
// 获取本月收支情况,细分 public JsonResult GetMonthClassGroup(int id) { IndexBusinessLayer ibl = new IndexBusinessLayer(); AccountBusinessLayer abl = new AccountBusinessLayer(); List <AccountClassInOutViewModel> acvm = new List <AccountClassInOutViewModel>(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); int UID = int.Parse(s); DateTime today = DateTime.Today; DateTime date1 = ibl.GetMonthFirstDay(today); DateTime date2 = ibl.GetMonthLastDay(today); List <AccountClassInOut> ag = ibl.GetMonthClassInOut(UID, id, date1, date2); foreach (var item in ag) { AccountClassInOutViewModel a = new AccountClassInOutViewModel(); a.Cname = abl.SearchClass(item.ClassesID); a.Money = item.Money; acvm.Add(a); } return(Json(acvm, JsonRequestBehavior.AllowGet)); }