public WC_OfficalAccounts GetCurrentAccount() { using (AppsDBEntities db = new AppsDBEntities()) { return(db.WC_OfficalAccounts.Where(p => p.IsDefault).FirstOrDefault()); } }
public SysModuleOperate GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.SysModuleOperate.SingleOrDefault(a => a.Id == id)); } }
/// <summary> /// 获取列表 /// ///</summary> /// <param name="db">数据库上下文</param> /// <returns>数据列表</returns> public IQueryable <SysSample> GetList(AppsDBEntities db) { IQueryable <SysSample> list = db.SysSample.AsQueryable(); return(list); }
public List <SysException> GetList(ref GridPager pager, string queryStr) { AppsDBEntities db = new AppsDBEntities(); List <SysException> query = null; IQueryable <SysException> list = exceptionRepository.GetList(db); if (!string.IsNullOrWhiteSpace(queryStr)) { list = list.Where(a => a.Message.Contains(queryStr)); pager.totalRows = list.Count(); } else { pager.totalRows = list.Count(); } if (pager.order == "desc") { query = list.OrderByDescending(c => c.CreateTime).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); } else { query = list.OrderBy(c => c.CreateTime).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList(); } return(query); }
public void Delete(AppsDBEntities db, string id) { SysModule entity = db.SysModule.SingleOrDefault(a => a.Id == id); if (entity != null) { //删除SysRight表数据 var sr = db.SysRight.AsQueryable().Where(a => a.ModuleId == id); foreach (var item in sr) { //删除SysRightOperate表数据 var sro = db.SysRightOperate.AsQueryable().Where(a => a.RightId == item.Id); foreach (var o in sro) { db.SysRightOperate.Remove(o); } db.SysRight.Remove(item); } //删除SysModuleOperate数据 var smo = db.SysModuleOperate.AsQueryable().Where(a => a.ModuleId == id); foreach (var item in smo) { db.SysModuleOperate.Remove(item); } db.SysModule.Remove(entity); } }
public SysUser GetById(int id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.SysUser.SingleOrDefault(s => s.Id == id)); } }
public Flow_FormAttr GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.Flow_FormAttr.SingleOrDefault(a => a.Id == id)); } }
/// <summary> /// 执行一条SQL语句 /// </summary> /// <param name="sql"></param> /// <returns></returns> public int ExecuteSqlCommand(string sql) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.Database.ExecuteSqlCommand(sql)); } }
public WC_MessageResponse GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.WC_MessageResponse.SingleOrDefault(a => a.Id == id)); } }
public Flow_FormContentStepCheck GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.Flow_FormContentStepCheck.SingleOrDefault(a => a.Id == id)); } }
public WC_OfficalAccounts GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.WC_OfficalAccounts.SingleOrDefault(a => a.Id == id)); } }
public int UpdateRight(SysRightOperateModel model) { //转换 SysRightOperate rightOperate = new SysRightOperate(); rightOperate.Id = model.Id; rightOperate.RightId = model.RightId; rightOperate.KeyCode = model.KeyCode; rightOperate.IsValid = model.IsValid; //判断rightOperate是否存在,如果存在就更新rightOperate,否则就添加一条 using (AppsDBEntities db = new AppsDBEntities()) { SysRightOperate right = db.SysRightOperate.Where(a => a.Id == rightOperate.Id).FirstOrDefault(); if (right != null) { right.IsValid = rightOperate.IsValid; } else { db.SysRightOperate.Add(rightOperate); } if (db.SaveChanges() > 0) { //更新角色--模块的有效标志RightFlag var sysRight = (from r in db.SysRight where r.Id == rightOperate.RightId select r).First(); db.P_Sys_UpdateSysRightRightFlag(sysRight.ModuleId, sysRight.RoleId); return(1); } } return(0); }
/// <summary> /// 根据ID获取实体 /// </summary> /// <param name="id"></param> /// <returns></returns> public SysException GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.SysException.SingleOrDefault(a => a.Id == id)); } }
public MIS_Article_Category GetById(string id) { using (AppsDBEntities db = new AppsDBEntities()) { return(db.MIS_Article_Category.SingleOrDefault(a => a.Id == id)); } }
public int Create(Flow_FormContentStepCheck entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Flow_FormContentStepCheck.Add(entity); return(db.SaveChanges()); } }
public int Create(WC_OfficalAccounts entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.WC_OfficalAccounts.Add(entity); return(db.SaveChanges()); } }
/// <summary> /// 创建一个实体 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Create(SysException entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.SysException.Add(entity); return(db.SaveChanges()); } }
/// <summary> /// 添加一个实体 /// </summary> /// <param name="entity">实体</param> /// <returns></returns> public int Create(SysSample entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Set <SysSample>().Add(entity); return(db.SaveChanges()); } }
public int Create(SysStruct entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.SysStruct.Add(entity); return(db.SaveChanges()); } }
/// <summary> /// 创建一个对象 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Create(SysLog entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.SysLog.Add(entity);//db.SysLog.AddObject(entity); 博客里面这么写,代码报错,没有addObject return(db.SaveChanges()); } }
public int Create(Flow_StepRule entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Flow_StepRule.Add(entity); return(db.SaveChanges()); } }
public int Create(Flow_FormAttr entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Flow_FormAttr.Add(entity); return(db.SaveChanges()); } }
public int Create(WC_MessageResponse entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.WC_MessageResponse.Add(entity); return(db.SaveChanges()); } }
public SysUser Login(string username, string pwd) { using (AppsDBEntities db = new AppsDBEntities()) { SysUser user = db.SysUser.SingleOrDefault(a => a.UserName == username && a.Password == pwd); return(user); } }
public int Create(SysModuleOperate entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.SysModuleOperate.Add(entity); return(db.SaveChanges()); } }
public int Create(MIS_Article_Category entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.MIS_Article_Category.Add(entity); return(db.SaveChanges()); } }
public int Create(SysModule entity) { using (AppsDBEntities db = new AppsDBEntities()) { //db.SysModule.AddObject(entity); db.SysModule.Add(entity); return(db.SaveChanges()); } }
/// <summary> /// 删除一条实体 /// </summary> /// <param name="id">实体ID</param> /// <returns></returns> public int Delete(string id) { using (AppsDBEntities db = new AppsDBEntities()) { SysSample entity = db.SysSample.SingleOrDefault(a => a.Id == id); db.Set <SysSample>().Remove(entity); return(db.SaveChanges()); } }
public int Delete(string id) { using (AppsDBEntities db = new AppsDBEntities()) { SysException entity = db.SysException.SingleOrDefault(a => a.Id == id); db.SysException.Remove(entity); return(db.SaveChanges()); } }
/// <summary> /// 修改一个实体 /// </summary> /// <param name="entity">实体</param> /// <returns></returns> public int Edit(SysSample entity) { using (AppsDBEntities db = new AppsDBEntities()) { db.Set <SysSample>().Attach(entity); db.Entry <SysSample>(entity).State = EntityState.Modified; return(db.SaveChanges()); } }