Ejemplo n.º 1
0
 public static IEnumerable <FaultComplexity> GetActiveComplexities()
 {
     using (var Context = new NPDEntities())
     {
         return(Context.FaultComplexities.OrderBy(x => x.Id).ToList());
     }
 }
Ejemplo n.º 2
0
 public static IEnumerable <UsersInfo> GetAllActiveEngineers()
 {
     using (var Context = new NPDEntities())
     {
         return(Context.UsersInfoes.Where(x => x.RoleId == 2).OrderBy(x => x.Name).ToList());
     }
 }
Ejemplo n.º 3
0
 public static UsersInfo ValidateUser(UsersInfo user)
 {
     using (var Context = new NPDEntities())
     {
         return(Context.UsersInfoes.FirstOrDefault(x => x.Email == user.Email && x.Password == user.Password));
     }
 }
Ejemplo n.º 4
0
 public static Fault GetFaultById(int id)
 {
     using (var Context = new NPDEntities())
     {
         return(Context.Faults.FirstOrDefault(x => x.Id == id));
     }
 }
Ejemplo n.º 5
0
 public static IEnumerable <FaultLibrary> GetFilesByFaultId(int id)
 {
     using (var Context = new NPDEntities())
     {
         return(Context.FaultLibraries.Where(x => x.FaultId == id).OrderByDescending(x => x.Id).ToList());
     }
 }
Ejemplo n.º 6
0
 public static IEnumerable <CustomFault> GetFaults(Fault fault)
 {
     using (var Context = new NPDEntities())
     {
         return((from f in Context.Faults
                 join p in Context.FaultPriorities on f.Priority equals p.Id
                 join c in Context.FaultComplexities on f.Complexity equals c.Id
                 join co in Context.companies on f.CompanyId equals co.Id
                 join u in Context.UsersInfoes on f.AssignedTo equals u.Id
                 where f.Status == 1
                 select new CustomFault()
         {
             CompanyName = co.Name,
             AssignedTo = u.Name,
             Complexity = c.Name,
             FaultDescription = f.FaultDescription,
             FaultStatus = "",
             Location = f.Location,
             MachineDescription = f.MachineDescription,
             Priority = p.Name,
             CreatedDate = f.CreatedDate,
             Id = f.Id,
             StartDate = f.StartDate
         }).OrderByDescending(x => x.Complexity).ToList());
     }
 }
Ejemplo n.º 7
0
 public static IEnumerable <company> GetAllActive()
 {
     using (var Context = new NPDEntities())
     {
         return(Context.companies.OrderByDescending(x => x.CreatedDate).ToList());
     }
 }
Ejemplo n.º 8
0
 public static int SaveFile(FaultLibrary entity)
 {
     using (var Context = new NPDEntities())
     {
         Context.Set <FaultLibrary>().Add(entity);
         return(Context.SaveChanges());
     }
 }
Ejemplo n.º 9
0
 public static int SaveCompany(company companyEntity)
 {
     using (var Context = new NPDEntities())
     {
         Context.Set <company>().Add(companyEntity);
         return(Context.SaveChanges());
     }
 }
Ejemplo n.º 10
0
 public static int UpdateFault(Fault model)
 {
     using (var Context = new NPDEntities())
     {
         var fault = Context.Faults.FirstOrDefault(x => x.Id == model.Id);
         fault.CompanyId          = model.CompanyId;
         fault.Complexity         = model.Complexity;
         fault.FaultDescription   = model.FaultDescription;
         fault.FaultStatus        = model.Priority < 1 ? 0 : 1;
         fault.Location           = model.Location;
         fault.MachineDescription = model.MachineDescription;
         fault.ModifiedBy         = model.ModifiedBy;
         fault.ModifiedDate       = DateTime.Now;
         fault.Priority           = model.Priority;
         fault.StartDate          = DateTime.Now;
         fault.AssignedTo         = model.AssignedTo;
         return(Context.SaveChanges());
     }
 }