public async Task <List <Manager> > GetAllAdmin() { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Managers.Where(x => x.ExpireTime == null && x.Role == "admin").OrderBy(x => x.Name).ToListAsync()); } }
public async Task <Manager> GetByName(string name) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Managers.Where(x => x.ExpireTime == null && x.LoginName == name).FirstOrDefaultAsync()); } }
public async Task <Manager> GetAdmin() { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Managers.Where(x => x.ExpireTime == null && x.Role == "Admin").FirstOrDefaultAsync()); } }
public async Task <List <ContractNumber> > GetContractsByCustomerId(int customerId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.ContractNumbers.Where(x => x.ExpireTime == null && x.CustomerId == customerId).ToListAsync()); } }
public async Task <List <GroupProduct> > GetGroupProductByBuyerGroupId(int buyerGroupId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.GroupProducts.Where(x => x.ExpireTime == null && x.BuyerGroupId == buyerGroupId).ToListAsync()); } }
public async Task <Customer> GetCustomerByLoginId(string loginId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Customers.Where(x => x.LoginId == loginId && x.ExpireTime == null).FirstOrDefaultAsync()); } }
public async Task <Product> GetProductByCategoryId(int categoryId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Products.Where(x => x.CategoryId == categoryId && x.ExpireTime == null).FirstOrDefaultAsync()); } }
public async Task <Order> GetOrderById(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Orders.FirstOrDefaultAsync(x => x.Id == id && x.Mode != "0")); } }
public async Task <OrderDoc> GetOrderDocByOrderId(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.OrderDocs.Where(x => x.OrderId == id).FirstOrDefaultAsync()); } }
public async Task <OrderNumber> GetOrderNumberByMode(string mode) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.OrderNumbers.Where(x => x.Mode == mode).FirstOrDefaultAsync()); } }
public async Task <Product> GetProductByName(string code, int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Products.Where(x => x.Code == code && x.Id != id && x.ExpireTime == null).FirstOrDefaultAsync()); } }
/// <summary> /// get all uom /// </summary> /// <returns></returns> public async Task <List <Uom> > GetAll() { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Uoms.Where(x => x.ExpireTime == null).OrderBy(c => c.Name).ToListAsync()); } }
public async Task <Uom> GetUomByName(string name, int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Uoms.Where(x => x.Name == name && x.Id != id && x.ExpireTime == null).FirstOrDefaultAsync()); } }
/// <summary> /// get uom by id /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <Uom> GetById(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Uoms.Where(x => x.Id == id && x.ExpireTime == null).FirstOrDefaultAsync()); } }
/// <summary> /// get customer by company name /// </summary> /// <param name="comName"></param> /// <param name="loginId"></param> /// <param name="id"></param> /// <returns></returns> public async Task <Customer> GetCustomerByCompName(string comName, int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Customers.Where(x => x.CompanyName == comName && x.Id != id && x.ExpireTime == null).FirstOrDefaultAsync()); } }
public async Task <List <OrderAddress> > GetOrderAddrByCustomerId(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.OrderAddresses.Where(x => x.Order.CustomerId == id).ToListAsync()); } }
public async Task <List <BuyerGroup> > GetAll() { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.BuyerGroups.Where(x => x.ExpireTime == null).OrderBy(x => x.Code).ToListAsync()); } }
/// <summary> /// get addresses by customer id /// </summary> /// <param name="customerId"></param> /// <returns></returns> public async Task <List <DeliveryAddress> > GetAddrsByCustomerId(int customerId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.DeliveryAddresses.Where(x => x.ExpireTime == null && x.CustomerId == customerId).ToListAsync()); } }
/// <summary> /// get all addr /// </summary> /// <returns></returns> public async Task <List <DeliveryAddress> > GetAll() { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.DeliveryAddresses.Where(x => x.ExpireTime == null).ToListAsync()); } }
public async Task <Product> GetByIdAndCategoryId(int?id, int?categoryId) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Products.Include(x => x.Uom).Where(x => x.Id == id && x.ExpireTime == null && x.CategoryId == categoryId).FirstOrDefaultAsync()); } }
public async Task <List <Customer> > GetByBuyerGroupId(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Customers.Where(x => x.BuyerGroupId == id && x.ExpireTime == null).ToListAsync()); } }
/// <summary> /// add or update uom /// </summary> /// <param name="uom"></param> /// <returns></returns> public async Task <int> AddOrUpdate(Uom uom) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.Uoms.AddOrUpdate(uom); return(await context.SaveChangesAsync()); } }
public async Task <int> AddOrUpdate(OrderNumber orderNumber) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.OrderNumbers.AddOrUpdate(orderNumber); return(await context.SaveChangesAsync()); } }
public async Task <int> DeleteRange(List <Product> products) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.Products.RemoveRange(products); return(await context.SaveChangesAsync()); } }
public async Task <int> AddAddressList(IEnumerable <DeliveryAddress> addrList) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.DeliveryAddresses.AddRange(addrList); return(await context.SaveChangesAsync()); } }
/// <summary> /// add or update addr /// </summary> /// <param name="addr"></param> /// <returns></returns> public async Task <int> AddOrUpdate(DeliveryAddress addr) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.DeliveryAddresses.AddOrUpdate(addr); return(await context.SaveChangesAsync()); } }
public async Task <int> AddOrUpdate(Product product) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.Products.AddOrUpdate(product); return(await context.SaveChangesAsync()); } }
/// <summary> /// add or update customer /// </summary> /// <param name="customer"></param> /// <returns></returns> public async Task <int> AddOrUpdate(Customer customer) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.Customers.AddOrUpdate(customer); return(await context.SaveChangesAsync()); } }
public async Task <int> AddBulkAddress(List <DeliveryAddress> addrs) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { context.DeliveryAddresses.AddRange(addrs); return(await context.SaveChangesAsync()); } }
public async Task <Customer> GetByManagerId(int id) { using (DatanetCMSWebEntities context = new DatanetCMSWebEntities()) { return(await context.Customers.Where(x => x.ManagerId == id && x.ExpireTime == null) .FirstOrDefaultAsync()); } }