Beispiel #1
0
        public List <Client> getClients()
        {
            List <Client> list = new List <Client>();

            using (var db = new MedicModel())
            {
                list = db.Clients.ToList();
            }
            return(list);
        }
Beispiel #2
0
        public List <Laborant> getLaborants()
        {
            List <Laborant> list = new List <Laborant>();

            using (var db = new MedicModel())
            {
                list = db.Laborants.ToList();
            }
            return(list);
        }
Beispiel #3
0
 private async Task getChars()
 {
     await Task.Run(() =>
     {
         using (var db = new MedicModel())
         {
             list = db.BarcodeChars.ToList();
         }
     }
                    );
 }
Beispiel #4
0
 public void AddClient(Client client)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Clients.Add(client);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #5
0
 public void AddLaborant(Laborant Laborant)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Laborants.Add(Laborant);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #6
0
 public void AddAnalizeBlood(AnalizeBlood AnalizeBlood)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.AnalizeBloods.Add(AnalizeBlood);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #7
0
 public void AddAnalizeShit(AnalizeShit AnalizeShit)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.AnalizeShits.Add(AnalizeShit);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
 public void AddAnalizeMocha(AnalizeMocha AnalizeMocha)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.AnalizeMochas.Add(AnalizeMocha);
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #9
0
 public void DeleteClient(Client client)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Entry(client.User).State = EntityState.Deleted;
             db.Entry(client).State      = EntityState.Deleted;
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #10
0
 public void UpdateLaborant(Laborant Laborant)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Entry(Laborant.User).State = EntityState.Modified;
             db.Entry(Laborant).State      = EntityState.Modified;
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #11
0
 public void DeleteAnalizeBlood(AnalizeBlood AnalizeBlood)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Entry(AnalizeBlood.Analizi).State = EntityState.Deleted;
             db.Entry(AnalizeBlood).State         = EntityState.Deleted;
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #12
0
 public void UpdateAnalizeShit(AnalizeShit AnalizeShit)
 {
     using (var db = new MedicModel())
     {
         try
         {
             db.Entry(AnalizeShit.Analizi).State = EntityState.Modified;
             db.Entry(AnalizeShit).State         = EntityState.Modified;
             db.SaveChanges();
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Beispiel #13
0
        public List <Client> GetClients()
        {
            var        list = new List <Client>();
            MedicModel db   = null;

            using (db = new MedicModel())
            {
                try
                {
                    list = db.Clients.Include(e => e.User).ToList();
                }
                finally
                {
                    db.Dispose();
                };
            }
            return(list);
        }
Beispiel #14
0
        public List <Laboratory> GetLaboratories()
        {
            var        list = new List <Laboratory>();
            MedicModel db   = null;

            using (db = new MedicModel())
            {
                try
                {
                    list = db.Laboratories.ToList();
                }
                finally
                {
                    db.Dispose();
                };
            }
            return(list);
        }
Beispiel #15
0
        public List <AnalizeBlood> GetAnalizeBloods()
        {
            var        list = new List <AnalizeBlood>();
            MedicModel db   = null;

            using (db = new MedicModel())
            {
                try
                {
                    list = db.AnalizeBloods.Include(e => e.Analizi.Client).Include(e => e.Analizi.Laborant).ToList();
                }
                finally
                {
                    db.Dispose();
                };
            }
            return(list);
        }
Beispiel #16
0
        /// <summary>
        /// Метод для входа
        /// </summary>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <returns>Id Роли аккаунта (-1 - Пользователь не найден)</returns>
        public int Auth(string login, string password)
        {
            int id = -1;

            using (var db = new MedicModel())
            {
                var task = db.Users.FirstOrDefault(e => e.Login == login && e.Password == password);
                var user = task;
                if (user != null)
                {
                    id = user.IdType;
                }
            }
            if (id == -1)
            {
                throw new Exception("Неверный логин или пароль");
            }
            return(id);
        }