// menu表查询 public static HouseFenYe menuChaXun(int pageIndex, int pageSize)// { NewHope4Entities ent = new NewHope4Entities(); var obj = from p in ent.menu orderby p.MID where p.state == 0 select new { MID = p.MID, MNmae = p.MNmae, PID = p.Parentmenu.UserTypeName, TypeID = p.MenuType.MName, style = p.style, sort = p.sort, path = p.path, CreationDate = p.CreationDate, state = p.state }; var ms = obj.ToString(); HouseFenYe fy = new HouseFenYe(); fy.list = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
//根据菜单名称查询 public static HouseFenYe menuChaXunByName(string user2, int pageIndex, int pageSize)// { NewHope4Entities ent = new NewHope4Entities(); var obj = from p in ent.menu orderby p.MID select new { MID = p.MID, MNmae = p.MNmae, PID = p.Parentmenu.UserTypeName, TypeID = p.MenuType.MName, style = p.style, sort = p.sort, path = p.path, CreationDate = p.CreationDate, state = p.state }; try { int num = int.Parse(user2); obj = obj.Where(p => p.MID == num); } catch (Exception) { obj = obj.Where(p => p.MNmae.Contains(user2)); } HouseFenYe fy = new HouseFenYe(); fy.list = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
//根据员工名称查询 public static HouseFenYe roleChaXunByName(string user2, int pageIndex, int pageSize)// { NewHope4Entities ent = new NewHope4Entities(); var obj = from p in ent.role orderby p.RID select new { RID = p.RID, RName = p.RName, CreationDate = p.CreationDate, remark = p.remark, state = p.state }; try { int num = int.Parse(user2); obj = obj.Where(p => p.RID == num); } catch (Exception) { obj = obj.Where(p => p.RName.Contains(user2)); } HouseFenYe fy = new HouseFenYe(); fy.list = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
//根据员工名称查询 public static HouseFenYe departmentChaXunByName(string user2, int pageIndex, int pageSize)// { NewHope4Entities ent = new NewHope4Entities(); var obj = from p in ent.department orderby p.Did where p.state == 0 select new { Did = p.Did, DName = p.DName, CreationDate = p.CreationDate, state = p.state }; try { int num = int.Parse(user2); obj = obj.Where(p => p.Did == num); } catch (Exception) { obj = obj.Where(p => p.DName.Contains(user2)); } HouseFenYe fy = new HouseFenYe(); fy.list = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
//报损的方法 //报损查询所有的方法 //查询所有报损数据 public static PageList baosunchaall(int pageIndex, int pageSize) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.baosun orderby p.baosunID descending where p.zt != 4 select new { rukuid = p.baosunID, rukuType = p.baosunType.baosunTypeName, cpid = p.cpid, sum = p.baosunSum, userid = p.Admin.Name, caozuofs = p.caozuofs, time = p.createTime, rxid = p.bsID, zt = p.rukuZT.rzName, ztid = p.zt }; PageList fy = new PageList(); fy.DateList = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
/// <summary> /// role角色表新增 /// </summary> /// <param name="a"></param> /// <returns></returns> public static int roleXinZeng(role r) { NewHope4Entities ent = new NewHope4Entities(); ent.role.Add(r); return(ent.SaveChanges()); }
//出库新增页面的第一层添加 public static int CKxiangadd(CKxiang pd) { NewHope4Entities context = new NewHope4Entities(); context.CKxiang.Add(pd); return(context.SaveChanges()); }
//入库新增页面-第二次添加 public static int chuT2add(chuku rr) { NewHope4Entities context = new NewHope4Entities(); context.chuku.Add(rr); return(context.SaveChanges()); }
//入库界面查看的功能-看主表 public static IQueryable rukuchakan(int rid) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.ruku where rid == p.rukuID select new { rukuid = p.rukuID, rukuType = p.rukuType.rukuName, gysname = p.gysguanli.GName, gysid = p.gysID, gysman = p.gysguanli.linkman, cpid = p.cpID, sum = p.productguanli.kucun, zt = p.rukuZT.rzName, userid = p.Admin.Name, caozuofs = p.caozuofs, time = p.createTime, price = p.RKxiang.by4 * p.RKxiang.Pprice, rid = p.rid, phone = p.gysguanli.phone, rxid = p.rxID }; return(obj); }
//出库界面查看的功能-看主表 public static IQueryable chukuchakan(int ckid) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.chuku where ckid == p.chukuID select new { rukuid = p.chukuID, rukuType = p.chukuType.chukuTypeName, gysname = p.customer.KehuName, gysid = p.kehuID, gysman = p.customer.KehuName, cpid = p.cpID, sum = p.productguanli.kucun, zt = p.rukuZT.rzName, userid = p.Admin.Name, caozuofs = p.caozuofs, time = p.createTime, price = p.CKxiang.chuSum * p.CKxiang.Pprice, phone = p.customer.phone, ckid = p.ckID }; return(obj); }
//出库管理的方法 //查询所有出库数据 public static PageList chukuchaall(int pageIndex, int pageSize) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.chuku orderby p.chukuID where p.zt != 4 select new { chukuid = p.chukuID, chukuType = p.chukuType.chukuTypeName, kuhu = p.customer.KehuName, cpid = p.cpID, sum = p.productguanli.kucun, zt = p.rukuZT.rzName, userid = p.Admin.Name, caozuofs = p.caozuofs, time = p.createTime, price = p.CKxiang.chuSum * p.CKxiang.Pprice, ckid = p.ckID, ztid = p.zt }; PageList fy = new PageList(); fy.DateList = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); }
// admin管理员表查询 public static HouseFenYe AdminChaXun(int pageIndex, int pageSize)// { NewHope4Entities ent = new NewHope4Entities(); var obj = from p in ent.Admin orderby p.UserID where p.state == 0 select new { UserID = p.UserID, UserName = p.UserName, Name = p.Name, Email = p.Email, Phone = p.Phone, LoginNum = p.LoginNum, Did = p.department.DName, RID = p.role.RName, Userpwd = p.Userpwd, UserTypeID = p.UserTypeID, state = p.state }; var ms = obj.ToString(); HouseFenYe fy = new HouseFenYe(); fy.list = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); fy.PageCount = obj.Count(); return(fy); //return obj; }
//新增 public static int Get_guanliAdd(productguanli p) { NewHope4Entities uu = new NewHope4Entities(); uu.productguanli.Add(p); return(uu.SaveChanges()); }
//报损新增页面-第二次添加 public static int bsT2add(baosun rr) { NewHope4Entities context = new NewHope4Entities(); context.baosun.Add(rr); return(context.SaveChanges()); }
//新增 public static int Get_chanpinlbAdd(productType p) { NewHope4Entities uu = new NewHope4Entities(); uu.productType.Add(p); return(uu.SaveChanges()); }
//条件查询 public static IQueryable Get_chanpinguanlimohucha(string cpID, string cpName, int PID) { NewHope4Entities uu = new NewHope4Entities(); var obj = from p in uu.productguanli orderby p.ID ascending where p.state == 0 select new { ID = p.ID, //序号 cpID = p.cpID, //产品编号 条码 cpName = p.cpName, //显示名 产品名称 upper = p.upper, //上限 floor = p.floor, //下限 price = p.price, //价格 specification = p.specification, //规格 PID = p.PID, PNames = p.productType.PName, //类别 产品类别 MNames = p.measurement.MName, //单位 remark = p.remark, //备注 KehuNames = p.customer.KehuName, //客户 WNames = p.warehouse.WName, //默认仓库 KuNames = p.KuType.KuName, //默认库位 kucun = p.kucun }; if (cpID != null || cpName != null) { obj = obj.Where(p => p.cpID.Contains(cpID) || p.cpName.Contains(cpName)); } if (PID > 0) { obj = obj.Where(p => p.PID == PID); } return(obj); }
//计量单位 新增 public static int measurementadd(measurement k) { NewHope4Entities uu = new NewHope4Entities(); uu.measurement.Add(k); return(uu.SaveChanges()); }
/// <summary> /// 产品类别 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> //普通分页 public static PageList Get_chanpinglbAll(int pageIndex, int pageSize) { NewHope4Entities uu = new NewHope4Entities(); PageList list = new PageList(); var obj = from p in uu.productType orderby p.PID ascending where p.state == 0 select new { //XID = p.XID, PID = p.PID, PName = p.PName, //外键对象 UName = p.Admin.UserName, CreationDate = p.CreationDate, remark = p.remark }; //设置分页数据 list.DateList = obj.Skip((pageIndex - 1) * pageSize).Take(pageSize); list.PageCount = obj.Count(); //设置总页数 //int rows = uu.measurement.Count(); //list.PageCount = rows % pageSize == 0 ? rows / pageSize : rows / pageSize + 1; return(list); }
/// <summary> /// 新增地址表 /// </summary> /// <param name="d"></param> /// <returns></returns> public static int Get_kehuinsertdizhi(dizhi d) { NewHope4Entities context = new NewHope4Entities(); context.dizhi.Add(d); return(context.SaveChanges()); }
/// <summary> /// 编辑客户 /// </summary> /// <param name="kehuID"></param> /// <returns></returns> public static IQueryable Get_kehubyid(int kehuID) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.customer orderby p.kehuID descending where p.kehuID == kehuID && p.state == 0 select new { kehuID = p.kehuID, KehuName = p.KehuName, phone = p.phone, faxes = p.faxes, CreationDate = p.CreationDate, state = p.state, Email = p.Email, beizhu = p.beizhu, dizhiIDs = p.dizhiID, //dizhis = from pp in context.dizhi // where pp.dizhiID==p.dizhiID // select new // { // dizhiIDs = pp.dizhiID, // dizhiNames = pp.dizhiName, // linkmans = pp.linkman, // phones = pp.phone, // states = pp.state // }, row = context.customer.Count() }; return(obj); }
/// <summary> /// 客户分页 /// </summary> /// <param name="PageIndex"></param> /// <param name="PageSize"></param> /// <returns></returns> public static PageList Get_kehuAll(int PageIndex, int PageSize) { PageList list = new PageList(); NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.customer orderby p.kehuID descending where p.state == 0 select new { kehuID = p.kehuID, KehuName = p.KehuName, phone = p.phone, faxes = p.faxes, CreationDate = p.CreationDate, state = p.state, beizhu = p.beizhu, Email = p.Email, dizhiIDs = p.dizhiID, dizhiNames = p.dizhi.dizhiName, linkmans = p.dizhi.linkman, phones = p.dizhi.phone, states = p.dizhi.state, row = context.customer.Count() }; list.DateList = obj.Skip((PageIndex - 1) * PageSize).Take(PageSize); int rows = obj.Count(); //list.PageCount = rows % PageSize == 0 ? rows / PageSize : rows / PageSize + 1; list.PageCount = rows; return(list); }
/// <summary> /// 新增客户表 /// </summary> /// <param name="c"></param> /// <param name="d"></param> /// <returns></returns> public static int Get_kehuinsert(customer c) { NewHope4Entities context = new NewHope4Entities(); context.customer.Add(c); return(context.SaveChanges()); }
/// <summary> /// 供应商条件查询 /// </summary> /// <returns></returns> public static IQueryable Get_gystiaojiAll(int GID, string gystypeName) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.gysguanli where p.state == 0 select new { GID = p.GID, GName = p.GName, gystypeID = p.gystypeID, gystypeName = p.gystype.gystypeName, phone = p.phone, faxes = p.faxes, Email = p.Email, linkman = p.linkman, address = p.address, describe = p.describe, state = p.state }; if (GID > 0 || gystypeName != null) { obj = obj.Where(p => p.GID == GID || p.gystypeName.Contains(gystypeName)); } return(obj); }
/// <summary> /// 新增供应商 /// </summary> /// <param name="g"></param> /// <returns></returns> public static int Get_gysinsert(gysguanli g) { NewHope4Entities context = new NewHope4Entities(); context.gysguanli.Add(g); return(context.SaveChanges()); }
/// <summary> /// 供应商分页 /// </summary> /// <returns></returns> public static PageList Get_gongyingshangAll(int PageIndex, int PageSize) { PageList list = new PageList(); NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.gysguanli orderby p.GID descending where p.state == 0 select new { GID = p.GID, GName = p.GName, gystypeID = p.gystypeID, gystypeName = p.gystype.gystypeName, phone = p.phone, faxes = p.faxes, Email = p.Email, linkman = p.linkman, address = p.address, describe = p.describe, state = p.state, sum = context.gysguanli.Count() }; list.DateList = obj.Skip((PageIndex - 1) * PageSize).Take(PageSize); int rows = obj.Count(); //list.PageCount = rows % PageSize == 0 ? rows / PageSize : rows / PageSize + 1; list.PageCount = rows; return(list); }
/// <summary> /// 分页 /// </summary> /// <param name="PageIndex"></param> /// <param name="PageSize"></param> /// <returns></returns> public static PageList Get_kuweiAll(int PageIndex, int PageSize) { NewHope4Entities context = new NewHope4Entities(); PageList list = new PageList(); var obj = from p in context.storage orderby p.TID descending where p.state == 0 select new { TID = p.TID, KName = p.KName, WID = p.WID, KID = p.KID, WName = p.warehouse.WName, KuTypeID = p.KuTypeID, KuName = p.KuType.KuName, forbidden = p.forbidden, moren = p.moren, CreationDate = p.CreationDate, state = p.state, rows = context.storage.Count() }; list.DateList = obj.Skip((PageIndex - 1) * PageSize).Take(PageSize); //list.PageCount = rows % PageSize == 0 ? rows / PageSize : rows / PageSize + 1; list.PageCount = obj.Count(); return(list); }
/// <summary> /// 库位新增 /// </summary> /// <param name="s"></param> /// <returns></returns> public static int Get_kuweiInsert(storage s) { NewHope4Entities context = new NewHope4Entities(); context.storage.Add(s); return(context.SaveChanges()); }
//搜索入库单号的功能 public static IQueryable danhaocha(int rid) { NewHope4Entities context = new NewHope4Entities(); var obj = from p in context.ruku where p.rukuID == rid && p.zt != 4 select new { rukuid = p.rukuID, rukuType = p.rukuType.rukuName, gysname = p.gysguanli.GName, cpid = p.cpID, sum = p.RKxiang.by4, zt = p.rukuZT.rzName, userid = p.Admin.Name, caozuofs = p.caozuofs, time = p.createTime, price = p.RKxiang.by4 * p.RKxiang.Pprice, rid = p.rid, rxid = p.rxID, ztid = p.zt }; //context.Configuration.ProxyCreationEnabled = false; return(obj); }
//删除 public static int menuShanChu(menu m) { NewHope4Entities ent = new NewHope4Entities(); var obj = ent.menu.Find(m.MID); obj.state = 1; return(ent.SaveChanges()); }
// Parentmenu父级表新增 public static int ParentmenuXinZeng(Parentmenu p) { NewHope4Entities ent = new NewHope4Entities(); p.state = 0; ent.Parentmenu.Add(p); return(ent.SaveChanges()); }