예제 #1
0
 public static List <Worker> getAllWorkers(string includes)
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             return(db.Workers.Include(includes).ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public static List <Mishap> GetAllMishap <TKey>(string includes, Expression <Func <Mishap, TKey> > order)
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             return(db.Mishaps.Include(includes).OrderByDescending(order).ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public static Worker getWorkerByID(int id, string include)
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             return(db.Workers.Include(include).First(c => c.id_worker == id));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public static Mishap GetMishapByCode(int code, string include)
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             return(db.Mishaps.Include(include).First(c => c.mishap_code == code));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 public static void deleteWorkerByID(int id)
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             var worker = db.Workers.First(c => c.id_worker == id);
             db.Workers.Remove(worker);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
            //public static string DeleteMishap(int mishapId)
            //{
            //    try
            //    {
            //        using (var contex = new Garage_of_carsEntities())
            //        {
            //            contex.Mishaps.Remove(contex.Mishaps.Find(mishapId));
            //            contex.SaveChanges();
            //        }
            //        return ("ok");
            //    }
            //    catch (Exception ex)
            //    {

            //        throw ex;
            //    }
            //}
            public static void DeleteMishapByCode(int code)
            {
                try
                {
                    using (garage_of_carsEntities db = new garage_of_carsEntities())
                    {
                        var mishap = db.Mishaps.First(c => c.mishap_code == code);
                        db.Mishaps.Remove(mishap);
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
예제 #7
0
 public static Mishap InsertMishap(Mishap mishap)
 {
     try
     {
         using (var context = new garage_of_carsEntities())
         {
             context.Mishaps.Add(mishap);
             context.SaveChanges();
             return(mishap);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
        public static Worker getWorker(int id_worker, string password, string include)
        {
            Worker w = new Worker();

            try
            {
                using (garage_of_carsEntities db = new garage_of_carsEntities())
                {
                    var worker = db.Workers.Include(include).First(c => c.id_worker == id_worker);
                    w = worker;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(w);
        }
예제 #9
0
 private static void ConEmployeeStatus()
 {
     try
     {
         using (garage_of_carsEntities db = new garage_of_carsEntities())
         {
             Dictionary <int, ConvertDB> employee_status = new Dictionary <int, ConvertDB>();
             foreach (var item in db.Employee_kind)
             {
                 employee_status.Add(item.employee_kind_code, new ConvertDB()
                 {
                     ConvertCode        = item.employee_kind_code,
                     ConvertDescription = item.description_of_the_kind
                 });
             }
             allConvertDataBase.Add(Consts.employeeStatus, employee_status);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }