コード例 #1
0
        public int getEmpXCredenciales(string userName, string password)
        {
            try
            {
                using (TeamCellContext _dbContext = new TeamCellContext())
                {
                    var user = _dbContext.User.FirstOrDefault(x => x.UserName == userName);
                    if (user != null)
                    {
                        byte[] hashedPassword = Cryptographic.HashPasswordWithSalt(Encoding.UTF8.GetBytes(password), user.Salt);

                        if (hashedPassword.SequenceEqual(user.Password))
                        {
                            return(user.IdEmployee);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                    return(0);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
コード例 #2
0
        public List <object> StockGlobal()
        {
            try
            {
                using (TeamCellContext _BDContext = new TeamCellContext())
                {
                    List <Product> lstID = _BDContext.Product.ToList();

                    KardexController kardCont = new KardexController();
                    List <object>    result   = null;
                    foreach (Product i in lstID)
                    {
                        result.Add(new {
                            Codigo = i.Codigo,
                            Nombre = i.Name,
                            Stock  = kardCont.GetStockActual(i.IdProducto)
                        });
                    }

                    return(result);
                }
            }
            catch (Exception e)
            {
                return(new List <object>());
            }
        }
コード例 #3
0
        public decimal getCalcularPromedioSimpre(int id)
        {
            try
            {
                using (TeamCellContext _DBContext = new TeamCellContext())
                {
                    var TotalMonto = (from k in _DBContext.Kardex
                                      join ct in _DBContext.CostingAverage
                                      on k.IdKardex equals ct.IdKardex
                                      where k.IdProducto == id
                                      select new { ct.Cost }).Sum(x => x.Cost);

                    var TotalCant = (from k in _DBContext.Kardex
                                     join ct in _DBContext.CostingAverage
                                     on k.IdKardex equals ct.IdKardex
                                     where k.IdProducto == id
                                     select new { ct.Cost }).Count();

                    return(TotalMonto / TotalCant);
                }
            }
            catch
            {
                return(0);
            }
        }
コード例 #4
0
 public Client GetIdClient(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Client.Where(x => x.Id == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new Client());
     }
 }
コード例 #5
0
 public Country GetIdCountry(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Country.Where(x => x.IdCountry == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new Country());
     }
 }
コード例 #6
0
 public DetailPurchase GetdetailPurchase(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.DetailPurchase.Where(x => x.IdDetailPurchase == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new DetailPurchase());
     }
 }
コード例 #7
0
 public Purchases GetIdPurchases(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Purchases.Where(x => x.IdPurchases == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new Purchases());
     }
 }
コード例 #8
0
 public CostingWeighted getCostingWeightedXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.CostingWeighted.Where(x => x.IdCostingWeighted == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new CostingWeighted());
     }
 }
コード例 #9
0
 public Product getIdProduct(int id)
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             return(_BDContext.Product.Where(x => x.IdProducto == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new Product());
     }
 }
コード例 #10
0
 public Provider getProviderXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Provider.Where(x => x.IdProvider == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new Provider());
     }
 }
コード例 #11
0
 public Employee getEmployeeXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Employee.Where(x => x.IdEmployee == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new Employee());
     }
 }
コード例 #12
0
 public Warehouse getWarehouseXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Warehouse.Where(x => x.IdWarehouse == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new Warehouse());
     }
 }
コード例 #13
0
 public Brand getBrandXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Brand.Where(x => x.IdBrand == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new Brand());
     }
 }
コード例 #14
0
 public CostingAverage getCostingAverageXId(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.CostingAverage.Where(x => x.IdCostingAverage == id).FirstOrDefault());
         }
     }
     catch
     {
         return(new CostingAverage());
     }
 }
コード例 #15
0
 public Kardex GetIdKardex(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.Kardex.Where(x => x.IdKardex == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new Kardex());
     }
 }
コード例 #16
0
 public DetailBilling GetDetailBilling(int id)
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             return(_DBContext.DetailBilling.Where(x => x.IdDetailBilling == id).FirstOrDefault());
         }
     }
     catch (Exception e)
     {
         return(new DetailBilling());
     }
 }
コード例 #17
0
 public List <Country> getCountry()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Country.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <Country>());
     }
 }
コード例 #18
0
 public List <Provider> getProvider()
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             var result = _DBContext.Provider.ToList();
             return(result);
         }
     }
     catch
     {
         return(new List <Provider>());
     }
 }
コード例 #19
0
 public List <Brand> getBrand()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Brand.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <Brand>());
     }
 }
コード例 #20
0
 public List <CostingAverage> getCostingAverage()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.CostingAverage.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <CostingAverage>());
     }
 }
コード例 #21
0
 public decimal GetStockActual(int idProducto)
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             decimal result = _BDContext.Kardex.Where(x => x.IdProducto == idProducto).Sum(x => x.EntryAmount - x.OutputAmount);
             return(result);
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
コード例 #22
0
 public List <Product> getProduct()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Product.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <Product>());
     }
 }
コード例 #23
0
 public List <DetailPurchase> getDetailsPurchases(int id)
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.DetailPurchase.Where(x => x.IdPurchases == id).ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <DetailPurchase>());
     }
 }
コード例 #24
0
 public List <Client> GetClient()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Client.ToList();
             return(result);
         }
     }
     catch (Exception)
     {
         return(new List <Client>());
     }
 }
コード例 #25
0
 public List <DetailBilling> getDetailBilling(int id)
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.DetailBilling.Where(x => x.IdDetailBilling == id).ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <DetailBilling>());
     }
 }
コード例 #26
0
 public User getUserXId(int idUser)
 {
     try
     {
         using (TeamCellContext _dbContext = new TeamCellContext())
         {
             var user = _dbContext.User.Include(x => x.Employee).FirstOrDefault(x => x.IdUser == idUser);
             return(user);
         }
     }
     catch (Exception)
     {
         return(new User());
     }
 }
コード例 #27
0
 public List <Purchases> getPurchases()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Purchases.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <Purchases>());
     }
 }
コード例 #28
0
 public List <User> getUsersActive()
 {
     try
     {
         using (TeamCellContext _dbContext = new TeamCellContext())
         {
             var listUser = _dbContext.User.Include(x => x.Employee).Where(x => x.Status == true).ToList();
             return(listUser);
         }
     }
     catch (Exception ex)
     {
         return(new List <User>());
     }
 }
コード例 #29
0
 public List <Warehouse> getWarehouse()
 {
     try
     {
         using (TeamCellContext _BDContext = new TeamCellContext())
         {
             var result = _BDContext.Warehouse.ToList();
             return(result);
         }
     }
     catch (Exception e)
     {
         return(new List <Warehouse>());
     }
 }
コード例 #30
0
 public List <Employee> getEmployees()
 {
     try
     {
         using (TeamCellContext _DBContext = new TeamCellContext())
         {
             var result = _DBContext.Employee.ToList();
             return(result);
         }
     }
     catch
     {
         return(new List <Employee>());
     }
 }