public void Create(Materiel mat) { using (var ctx = new LYLQEntities()) { ctx.Materiels.Add(mat); ctx.SaveChanges(); } }
public void Create(Department dpt) { using (var ctx = new LYLQEntities()) { ctx.Departments.Add(dpt); ctx.SaveChanges(); } }
public void Create(InStore dpt) { using (var ctx = new LYLQEntities()) { ctx.InStores.Add(dpt); ctx.SaveChanges(); } }
public void Create(OutStore ots) { using (var ctx = new LYLQEntities()) { ctx.OutStores.Add(ots); ctx.SaveChanges(); } }
public List<User> GetAll() { using (var ctx = new LYLQEntities()) { var dbUsers = from user in ctx.Users select user; return dbUsers.ToList(); } }
public List<Materiel> GetByType(string type) { using (var ctx = new LYLQEntities()) { var dbMats = from mat in ctx.Materiels where mat.Type == type select mat; return dbMats.ToList(); } }
public Materiel GetByCode(string code) { using (var ctx = new LYLQEntities()) { var dbMats = from mat in ctx.Materiels where mat.Code == code select mat; return dbMats.FirstOrDefault(); } }
public List<Materiel> GetAll() { using (var ctx = new LYLQEntities()) { var dbMats = from mat in ctx.Materiels orderby mat.Type, mat.Code select mat; return dbMats.ToList(); } }
public List<OutStore> GetByType(string type) { using (var ctx = new LYLQEntities()) { var dbOsts = from outs in ctx.OutStores where outs.Type == type select outs; return dbOsts.ToList(); } }
public OutStore GetById(string id) { using (var ctx = new LYLQEntities()) { var dbOsts = from ost in ctx.OutStores where ost.Id == id select ost; return dbOsts.FirstOrDefault(); } }
public List<InStore> GetByCodeUnitPrice(string code, decimal unitPrice) { using (var ctx = new LYLQEntities()) { var dbInsts = from inst in ctx.InStores where inst.Code == code && inst.UnitPrice == unitPrice && inst.RemainNumber > 0 select inst; return dbInsts.ToList(); } }
public List<Department> GetAll() { using (var ctx = new LYLQEntities()) { var dbDpts = from dpt in ctx.Departments orderby dpt.Type descending, dpt.Code select dpt; return dbDpts.ToList(); } }
public void Create(User user) { using (var ctx = new LYLQEntities()) { user.Id = Guid.NewGuid().ToString(); ctx.Users.Add(user); ctx.SaveChanges(); } }
public List<InStore> GetByType(string type) { using (var ctx = new LYLQEntities()) { var dbInsts = from inst in ctx.InStores where inst.Type == type select inst; return dbInsts.ToList(); } }
public User GetByAccount(string account) { using (var ctx = new LYLQEntities()) { var dbUsers = from user in ctx.Users where user.Account == account select user; return dbUsers.FirstOrDefault(); } }
public Department GetByCode(string code) { using (var ctx = new LYLQEntities()) { var dbDpts = from dpt in ctx.Departments where dpt.Code == code select dpt; return dbDpts.FirstOrDefault(); } }
public InStore GetById(string id) { using (var ctx = new LYLQEntities()) { var dbInsts = from inst in ctx.InStores where inst.Id == id select inst; return dbInsts.FirstOrDefault(); } }
public List<OutStore> GetAll() { using (var ctx = new LYLQEntities()) { var dbOsts = from ost in ctx.OutStores orderby ost.UpdatedDate descending select ost; return dbOsts.ToList(); } }
public List<InStore> GetAll() { using (var ctx = new LYLQEntities()) { var dbInsts = from dpt in ctx.InStores orderby dpt.UpdatedDate descending select dpt; return dbInsts.ToList(); } }
public void Delete(string code) { using (var ctx = new LYLQEntities()) { var dbDpts = from dbDpt in ctx.Departments where dbDpt.Code == code select dbDpt; ctx.Departments.Remove(dbDpts.First()); ctx.SaveChanges(); } }
public void Delete(string code) { using (var ctx = new LYLQEntities()) { var dbUsers = from dbMaterial in ctx.Materiels where dbMaterial.Code == code select dbMaterial; ctx.Materiels.Remove(dbUsers.First()); ctx.SaveChanges(); } }
public void Delete(string id) { using (var ctx = new LYLQEntities()) { var dbUsers = from dbUser in ctx.Users where dbUser.Id == id select dbUser; ctx.Users.Remove(dbUsers.First()); ctx.SaveChanges(); } }
public void Delete(string id) { using (var ctx = new LYLQEntities()) { var dbInsts = from dbInst in ctx.InStores where dbInst.Id == id select dbInst; var dbModelInSt = dbInsts.First(); ctx.InStores.Remove(dbModelInSt); ctx.SaveChanges(); } }
public List<OutStore> Query(DateTime beginDate, DateTime endDate, string type, string code, string operatorStoreOut, string deptCode = null) { using (var ctx = new LYLQEntities()) { var dbOutStores = from dboutStore in ctx.OutStores where (dboutStore.UpdatedDate >= beginDate && dboutStore.UpdatedDate <= endDate) && (type != null ? dboutStore.Type == type : 1 == 1) && (code != null ? dboutStore.Code == code : 1 == 1) && (operatorStoreOut != null ? dboutStore.UpdatedBy == operatorStoreOut : 1 == 1) && (deptCode != null ? dboutStore.Department == deptCode : 1 == 1 ) orderby dboutStore.UpdatedDate descending, dboutStore.Department select dboutStore; return dbOutStores.ToList(); } }
public void Update(Materiel mat) { using (var ctx = new LYLQEntities()) { var dbMats = from dbMat in ctx.Materiels where dbMat.Code == mat.Code select dbMat; var dbModelDpt = dbMats.First(); dbModelDpt.Name = mat.Name; dbModelDpt.UpdatedBy = mat.UpdatedBy; dbModelDpt.UpdatedDate = DateTime.Now; ctx.SaveChanges(); } }
public void Update(User user) { using (var ctx = new LYLQEntities()){ var dbUsers = from dbUser in ctx.Users where dbUser.Id == user.Id select dbUser; var dbModelUser = dbUsers.First(); dbModelUser.Password = user.Password; dbModelUser.Demartment = user.Demartment; dbModelUser.Enabled = user.Enabled; dbModelUser.UpdatedBy = user.UpdatedBy; dbModelUser.UpdatedDate = DateTime.Now; ctx.SaveChanges(); } }
public void OutStore(InStore dpt) { using (var ctx = new LYLQEntities()) { var dbInsts = from dbInst in ctx.InStores where dbInst.Id == dpt.Id select dbInst; var dbModelInSt = dbInsts.First(); dbModelInSt.RemainNumber = dpt.RemainNumber; dbModelInSt.RemainTotalPrice = dpt.RemainTotalPrice; dbModelInSt.UpdatedBy = dpt.UpdatedBy; dbModelInSt.UpdatedDate = DateTime.Now; ctx.SaveChanges(); } }
public List<InStore> GetKCByType(string type, string code) { using (var ctx = new LYLQEntities()) { type = type ?? ""; code = code ?? ""; var dbInsts = from inst in ctx.InStores where (type == "" ? true : inst.Type == type) && (code == "" ? true : inst.Code == code) && inst.RemainNumber > 0 select inst; return dbInsts.ToList(); } }
public void Update(Department dpt) { using (var ctx = new LYLQEntities()) { var dbDpts = from dbDpt in ctx.Departments where dbDpt.Code == dpt.Code select dbDpt; var dbModelDpt = dbDpts.First(); dbModelDpt.Name = dpt.Name; dbModelDpt.UpdatedBy = dpt.UpdatedBy; dbModelDpt.UpdatedDate = DateTime.Now; ctx.SaveChanges(); } }
public List<InStore> Query(DateTime beginDate, DateTime endDate, string type, string code, string operatorStoreIn) { using (var ctx = new LYLQEntities()) { var dbInsts = from dbInst in ctx.InStores where (dbInst.UpdatedDate >= beginDate && dbInst.UpdatedDate <= endDate) && (type != null ? dbInst.Type == type : 1== 1) && (code != null ? dbInst.Code == code : 1== 1) && (operatorStoreIn != null ? dbInst.UpdatedBy == operatorStoreIn : 1 == 1) orderby dbInst.UpdatedDate descending, dbInst.Type select dbInst; return dbInsts.ToList(); } }