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());
     }
 }
Exemplo n.º 4
0
 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());
     }
 }
Exemplo n.º 5
0
 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());
     }
 }
Exemplo n.º 7
0
 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());
     }
 }
Exemplo n.º 8
0
 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());
     }
 }
Exemplo n.º 11
0
 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());
     }
 }
Exemplo n.º 12
0
 /// <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());
     }
 }
Exemplo n.º 13
0
 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());
     }
 }
Exemplo n.º 14
0
 /// <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());
     }
 }
Exemplo n.º 16
0
 public async Task <List <OrderAddress> > GetOrderAddrByCustomerId(int id)
 {
     using (DatanetCMSWebEntities context = new DatanetCMSWebEntities())
     {
         return(await context.OrderAddresses.Where(x => x.Order.CustomerId == id).ToListAsync());
     }
 }
Exemplo n.º 17
0
 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());
     }
 }
Exemplo n.º 18
0
 /// <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());
     }
 }
Exemplo n.º 19
0
 /// <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());
     }
 }
Exemplo n.º 20
0
 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());
     }
 }
Exemplo n.º 22
0
 /// <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());
     }
 }
Exemplo n.º 24
0
 public async Task <int> DeleteRange(List <Product> products)
 {
     using (DatanetCMSWebEntities context = new DatanetCMSWebEntities())
     {
         context.Products.RemoveRange(products);
         return(await context.SaveChangesAsync());
     }
 }
Exemplo n.º 25
0
 public async Task <int> AddAddressList(IEnumerable <DeliveryAddress> addrList)
 {
     using (DatanetCMSWebEntities context = new DatanetCMSWebEntities())
     {
         context.DeliveryAddresses.AddRange(addrList);
         return(await context.SaveChangesAsync());
     }
 }
Exemplo n.º 26
0
 /// <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());
     }
 }
Exemplo n.º 27
0
 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());
     }
 }
Exemplo n.º 29
0
 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());
     }
 }