public void SetAdmin(int id, Boolean state) { FinancialERPDAL db = new FinancialERPDAL(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); User user = (from m in db.Users where m.UserID == id select m).Single <User>(); user.UAuthority = state; Operate o = new Operate(); o.AdminID = int.Parse(s); o.UserID = id; o.OperateDate = DateTime.Now; if (state) { o.OperateState = "授权"; } else { o.OperateState = "撤销"; } db.Operates.Add(o); db.SaveChanges(); }
public String SaveContention(Contention c) { FinancialERPDAL finanDal = new FinancialERPDAL(); finanDal.Contentions.Add(c); finanDal.SaveChanges(); return("提交成功"); }
public Borrow SaveBorrow(Borrow b) { FinancialERPDAL finanDal = new FinancialERPDAL(); finanDal.Borrows.Add(b); finanDal.SaveChanges(); return(b); }
public User SaveUser(User u) { FinancialERPDAL finanDal = new FinancialERPDAL(); finanDal.Users.Add(u); finanDal.SaveChanges(); return(u); }
// 保存新增数据 public Account SaveAccount(Account a) { FinancialERPDAL finanDal = new FinancialERPDAL(); finanDal.Accounts.Add(a); finanDal.SaveChanges(); return(a); }
public int SaveTitle(Title t) { FinancialERPDAL finanDal = new FinancialERPDAL(); finanDal.Titles.Add(t); finanDal.SaveChanges(); return(GetTitle(t.TName)); }
public void SavePassword(int UID, String newPassword) { FinancialERPDAL db = new FinancialERPDAL(); User tmp = new User(); tmp = (from m in db.Users where m.UserID == UID select m).Single <User>(); tmp.UPassword = newPassword; db.SaveChanges(); }
public void DeleteBorrowItem(int id) { FinancialERPDAL db = new FinancialERPDAL(); var delItem = db.Borrows.FirstOrDefault(m => m.BorrowID == id); if (delItem != null) { db.Borrows.Remove(delItem); db.SaveChanges(); } }
public void SavePassword(String UName, String newPassword) { FinancialERPDAL db = new FinancialERPDAL(); User tmp = new User(); var user = from m in db.Users select m; user = user.Where(s => s.UName.Equals(UName)); tmp = user.SingleOrDefault <User>(); tmp.UPassword = newPassword; db.SaveChanges(); }
public Boolean DeleteContention(int CID) { FinancialERPDAL db = new FinancialERPDAL(); var delItem = db.Contentions.FirstOrDefault(m => m.ContentionID == CID); if (delItem != null) { db.Contentions.Remove(delItem); db.SaveChanges(); return(true); } return(false); }
// 删除某一项 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 void ChangeItemState(Borrow b) { FinancialERPDAL db = new FinancialERPDAL(); Borrow tmp = new Borrow(); tmp = (from m in db.Borrows where m.BorrowID == b.BorrowID select m).Single <Borrow>(); tmp.BNextRepay = b.BNextRepay; tmp.BHavePay = b.BHavePay; tmp.BFinish = b.BFinish; db.SaveChanges(); }
public void EditItem(Account a) { FinancialERPDAL db = new FinancialERPDAL(); Account tmp = new Account(); tmp = (from m in db.Accounts where m.AccountID == a.AccountID select m).Single <Account>(); tmp.GenreID = a.GenreID; tmp.ClassesID = a.ClassesID; tmp.Money = a.Money; tmp.Date = a.Date; tmp.Remark = a.Remark; db.SaveChanges(); }
public Boolean DeleteTitle(int TID) { FinancialERPDAL db = new FinancialERPDAL(); var contentions = db.Contentions.Where(m => m.TitleID == TID); var titles = db.Titles.SingleOrDefault(m => m.TitleID == TID); if (contentions != null) { foreach (var item in contentions) { db.Contentions.Remove(item); } db.Titles.Remove(titles); db.SaveChanges(); return(true); } return(false); }
public void EditItem(Borrow b) { FinancialERPDAL db = new FinancialERPDAL(); Borrow tmp = new Borrow(); tmp = (from m in db.Borrows where m.BorrowID == b.BorrowID select m).Single <Borrow>(); tmp.BTitle = b.BTitle; tmp.BTotal = b.BTotal; tmp.BMonthShouldPay = b.BMonthShouldPay; tmp.BNextRepay = b.BNextRepay; tmp.BShouldPay = b.BShouldPay; tmp.BHavePay = b.BHavePay; tmp.BRemark = b.BRemark; tmp.BFinish = b.BFinish; db.SaveChanges(); }
public ActionResult SaveApply(Apply a, String BtnSubmit) { switch (BtnSubmit) { case "保存": FinancialERPDAL db = new FinancialERPDAL(); string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); int UID = int.Parse(s); a.ApplyDate = DateTime.Now; a.IsDeal = false; a.UserID = UID; db.Applys.Add(a); db.SaveChanges(); ViewData["Message"] = "提交成功!"; return(RedirectToAction("Title")); case "取消": return(RedirectToAction("Title")); } return(new EmptyResult()); }
public void ChangeState(int id, Boolean state) { FinancialERPDAL db = new FinancialERPDAL(); Apply apply = (from m in db.Applys where m.ApplyID == id select m).Single <Apply>(); apply.IsDeal = true; string s = System.Web.HttpContext.Current.Session["UserID"].ToString(); Diary d = new Diary(); d.AdminID = int.Parse(s); d.ApplyID = id; d.DiaryDate = DateTime.Now; if (state) { User user = (from n in db.Users where n.UserID == apply.UserID select n).Single <User>(); user.UAuthority = true; d.ApplyState = "批准"; Operate o = new Operate(); o.AdminID = d.AdminID; o.OperateDate = d.DiaryDate; o.UserID = id; o.OperateState = "授权"; db.Operates.Add(o); } else { d.ApplyState = "驳回"; } db.Diaries.Add(d); db.SaveChanges(); }