Ejemplo n.º 1
0
 public List <TypeWeight> GetWeight()
 {
     using (var db = new PlasticFactoryEntities())
     {
         return(db.TypeWeights.ToList());
     }
 }
Ejemplo n.º 2
0
 public string AutoGetMSNV()
 {
     using (var db = new PlasticFactoryEntities())
     {
         return(db.AutoIdEmployee().FirstOrDefault());
     }
 }
Ejemplo n.º 3
0
 public int GetIDByTypeOfCurrently(string Type)
 {
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.TypeofCustomers.ToList();
         int ID   = list.Last(u => u.isDelete == false && u.Type == Type).ID;
         return(ID + 1);
     }
 }
Ejemplo n.º 4
0
 public int GetIDByType(string type)
 {
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.TypeofCustomers.ToList();
         int ID   = list.First(u => u.isDelete == false && u.Type == type).ID;
         return(ID);
     }
 }
Ejemplo n.º 5
0
 public int GetIDByNameLicence(string Name)
 {
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.Trucks;
         int ID   = list.FirstOrDefault(u => u.LicencePlate == Name).ID;
         return(ID);
     }
 }
Ejemplo n.º 6
0
 public string GetNameEmployee(string MSNV)
 {
     using (var db = new PlasticFactoryEntities())
     {
         return(db.Employees
                .Where(u => u.MSNV == MSNV)
                .Select(u => u.Hoten).FirstOrDefault());
     }
 }
Ejemplo n.º 7
0
 public List <string> GetNameEmployee()
 {
     using (var db = new PlasticFactoryEntities())
     {
         List <string> list;
         var           select = db.Employees.Where(u => u.isDelete == false).Select(u => u.Hoten);
         list = select.ToList();
         return(list);
     }
 }
Ejemplo n.º 8
0
 public List <string> GetIdByName(string Name)
 {
     using (var db = new PlasticFactoryEntities())
     {
         return(db.Employees.
                Where(u => u.Hoten == Name).
                Select(u => u.MSNV).
                ToList());
     }
 }
Ejemplo n.º 9
0
 public List <int> GetIDByCustomerName(string Name)
 {
     using (var db = new PlasticFactoryEntities())
     {
         var        dbSet = db.Customers;
         List <int> list  = dbSet.AsNoTracking()
                            .Where(u => u.Name == Name)
                            .Select(u => u.ID)
                            .ToList();
         return(list);
     }
 }
Ejemplo n.º 10
0
 public List <string> GetTypeofCustomer()
 {
     using (var db = new PlasticFactoryEntities())
     {
         List <string> listDB = db.TypeofCustomers
                                .AsNoTracking()
                                .Where(u => u.isDelete == false)
                                .Select(u => u.Type)
                                .ToList();
         return(listDB);
     }
 }
Ejemplo n.º 11
0
 public int GetID()
 {
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.ProductOutputs.ToList();
         if (list.Count() != 0)
         {
             return(list.Last().ID + 1);
         }
         return(1);
     }
 }
Ejemplo n.º 12
0
 public bool checkNameEmployee(string name)
 {
     using (var db = new PlasticFactoryEntities())
     {
         object check = db.Employees.FirstOrDefault(u => u.Hoten == name);
         if (check != null)
         {
             return(true);
         }
         return(false);
     }
 }
Ejemplo n.º 13
0
 public int GetID()
 {
     sqlQuery("DBCC CHECKIDENT ('ProductOutput', RESEED, 1)");
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.ProductOutputs.ToList();
         if (list.Count() != 0)
         {
             return(list.Last().ID + 1);
         }
         return(1);
     }
 }
Ejemplo n.º 14
0
 public bool IsEmployeeByDateDB(string MSNV, string Date, string timeStart)
 {
     using (var db = new PlasticFactoryEntities())
     {
         DateTime dateTime = DateTime.Parse(Date);
         int      result   = db.Timekeepings.Count(u => u.isDelete == false && u.MSNV == MSNV && u.Date == dateTime && u.TimeStart == timeStart);
         if (result != 0)
         {
             return(true);
         }
         return(false);
     }
 }
Ejemplo n.º 15
0
 public int GetIdByMSNVDate(string MSNV, DateTime date)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             return(db.Timekeepings.First(u => u.isDelete == false && u.MSNV == MSNV && u.Date == date).Id);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 16
0
 public int GetPriceByName(string Name)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             var list = db.ProductIPs;
             int ID   = list.First(u => u.Name == Name && u.isDelete == false).Price.Value;
             return(ID);
         }
     }
     catch {
         return(0);
     }
 }
Ejemplo n.º 17
0
 public bool isDelete(int ID)
 {
     using (var db = new PlasticFactoryEntities())
     {
         try
         {
             EmployeePayment employeePayment = db.EmployeePayments.Find(ID);
             employeePayment.isDelete = true;
             db.SaveChanges();
             return(true);
         }
         catch
         {
             throw;
         }
     }
 }
Ejemplo n.º 18
0
 public bool isDelete(string ID)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             Employee employee = db.Employees.Find(ID);
             employee.isDelete = true;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 19
0
 public bool Update(EmployeePayment item)
 {
     using (var db = new PlasticFactoryEntities())
     {
         try
         {
             EmployeePayment employeePayment = db.EmployeePayments.Find(item.ID);
             employeePayment.PAY  = item.PAY;
             employeePayment.DATE = item.DATE.Value;
             db.SaveChanges();
             return(true);
         }
         catch {
             throw;
         }
     }
 }
Ejemplo n.º 20
0
 public bool isDelete(string msnv, DateTime date, string timeStart)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             Timekeeping timekeeping = db.Timekeepings.Where(u => u.isDelete == false && u.MSNV == msnv && u.Date == date && u.TimeStart == timeStart).First();
             timekeeping.isDelete = true;
             db.SaveChanges();
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 21
0
 public bool isDelete(int ID)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             var obj = db.PaymentOutputs.Find(ID);
             obj.isDelete = true;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 22
0
 public bool isDelete(int id)
 {
     using (var db = new PlasticFactoryEntities())
     {
         try
         {
             var      dbSet = db.Customers;
             Customer obj   = dbSet.Find(id);
             obj.isDelete = true;
             db.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 23
0
 public bool UpdateInventory(Quantity quantity)
 {
     try
     {
         using (var db = new PlasticFactoryEntities())
         {
             Quantity obj  = new Quantity();
             DateTime date = quantity.Date.Value;
             int      ID   = GetData(u => u.Date.Value.Day == date.Day && u.Date.Value.Month == date.Month && u.Date.Value.Year == date.Year).First().Id;
             obj = db.Quantities.Find(ID);
             obj.TotalInventory = quantity.TotalInventory;
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 24
0
 public bool isExistLicencePlate(string Name)
 {
     using (var db = new PlasticFactoryEntities())
     {
         var list = db.Trucks;
         if (list.Count() == 0)
         {
             return(true);
         }
         else
         {
             int count = list.Count(u => u.LicencePlate == Name);
             if (count == 1)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
 }