public virtual ActionResult Feed(string id) { var items = new List <SyndicationItem>(); using (SkillTreeHomeworkEntities context = new SkillTreeHomeworkEntities()) { var query = from item in context.AccountBook orderby item.Dateee descending select item; var topTen = query.Take(10); foreach (var content in topTen) { string feedTitle = ""; if (content.Categoryyy == 0) { feedTitle = "支出|"; } else { feedTitle = "收入|"; } var helper = new UrlHelper(this.Request.RequestContext); var url = helper.Action("Index", "Home", new { }, Request.IsSecureConnection ? "https" : "http"); var feedPackageItem = new SyndicationItem(feedTitle + content.Remarkkk.ToString(), content.Amounttt.ToString("N0"), new Uri(url)); feedPackageItem.PublishDate = content.Dateee; items.Add(feedPackageItem); } return(new RssActionResult("我的記帳本 RSS", items)); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (this.db != null) { this.db.Dispose(); this.db = null; } } }
public IEnumerable <MoneyTemplateViewModels> GetItemList() { List <MoneyTemplateViewModels> moneyTemplateViewModels = new List <MoneyTemplateViewModels>(); var Conn = new SkillTreeHomeworkEntities().Database.Connection; string strSQL = "select Id id, Categoryyy category, Amounttt money, Dateee date, Remarkkk description " + " from AccountBook " + " order by Dateee "; moneyTemplateViewModels = Conn.Query <MoneyTemplateViewModels>(strSQL, null).ToList(); return(moneyTemplateViewModels); }
public IEnumerable <MoneyViewModel> GetList() { using (var _accountData = new SkillTreeHomeworkEntities()) { return((from c in _accountData.AccountBook select new MoneyViewModel { SelectedTypes = c.Categoryyy, Date = c.Dateee, Money = c.Amounttt, Note = c.Remarkkk }).ToList()); } }
public void save(MoneyData viewModel) { using (SkillTreeHomeworkEntities db = new SkillTreeHomeworkEntities()) { AccountBook accountBook = new AccountBook { Dateee = viewModel.time, Amounttt = (int)viewModel.money, Categoryyy = viewModel.moneyType, Remarkkk = viewModel.remark, Id = Guid.NewGuid() }; db.AccountBook.Add(accountBook); db.SaveChanges(); } }
public IEnumerable <MoneyData> getDataLists() { using (SkillTreeHomeworkEntities db = new SkillTreeHomeworkEntities()) { int i = 0; foreach (AccountBook accountBook in db.AccountBook.OrderBy(s => s.Dateee)) { MoneyData moneyData = new MoneyData { number = ++i, moneyType = accountBook.Categoryyy, time = accountBook.Dateee, money = accountBook.Amounttt, }; yield return(moneyData); } } }
public ActionResult Index(AccountContentViewModel data) { if (ModelState.IsValid) { var accountBookNew = new AccountBook { Id = Guid.NewGuid(), Categoryyy = data.accountCategory, Amounttt = (int)data.accountFee, Dateee = data.accountDate, Remarkkk = data.accountNote }; SkillTreeHomeworkEntities db = new SkillTreeHomeworkEntities(); db.AccountBook.Add(accountBookNew); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } return(View(data)); }
public ActionResult ShowAccountContent() { List <AccountContentViewModel> accountList = new List <AccountContentViewModel>(); //accountList.Add(new AccountContentViewModel { accountCategory = "支出", accountDate = new DateTime(2016, 1, 1), accountFee = 300, accountNote = "" }); //accountList.Add(new AccountContentViewModel { accountCategory = "支出", accountDate = new DateTime(2016, 1, 2), accountFee = 1600, accountNote = "" }); //accountList.Add(new AccountContentViewModel { accountCategory = "支出", accountDate = new DateTime(2016, 1, 3), accountFee = 800, accountNote = "" }); using (SkillTreeHomeworkEntities context = new SkillTreeHomeworkEntities()) { var query = from item in context.AccountBook orderby item.Dateee descending select item; foreach (var item in query) { accountList.Add(new AccountContentViewModel { accountCategory = item.Categoryyy, accountFee = item.Amounttt, accountDate = item.Dateee, accountNote = item.Remarkkk }); } } return(View(accountList)); }
/// <summary> /// 取得記帳本全部資料 /// </summary> /// <returns></returns> public static List <SpendingViewModels> GetAccountBookList() { SkillTreeHomeworkEntities _db = new SkillTreeHomeworkEntities(); List <SpendingViewModels> ViewModles = new List <SpendingViewModels>(); var AccountBookList = _db.AccountBook.ToList(); SpendingViewModels item = new SpendingViewModels(); foreach (var VARIABLE in AccountBookList) { item = new SpendingViewModels { Category = VARIABLE.Categoryyy.ToString(), Amount = VARIABLE.Amounttt, Day = VARIABLE.Dateee, Remarks = VARIABLE.Remarkkk }; ViewModles.Add(item); } return(ViewModles); }
// GET: Admin/Admin public ActionResult Index() { if (User.Identity.IsAuthenticated) { List <AccountContentViewModel> accountList = new List <AccountContentViewModel>(); using (SkillTreeHomeworkEntities context = new SkillTreeHomeworkEntities()) { var query = from item in context.AccountBook orderby item.Dateee descending select item; foreach (var item in query) { accountList.Add(new AccountContentViewModel { accountCategory = item.Categoryyy, accountFee = item.Amounttt, accountDate = item.Dateee, accountNote = item.Remarkkk }); } } return(View(accountList)); } else { return(RedirectToAction("Index", new { controller = "Home", area = "" })); } }
public AccountBookRepository() { this.db = new SkillTreeHomeworkEntities(); }
public Repository() { _SkillEntities = new SkillTreeHomeworkEntities(); Dbset = _SkillEntities.Set <T>(); }
public AccountingService() { _db = new SkillTreeHomeworkEntities(); }