예제 #1
0
파일: Admin.cs 프로젝트: vitsv/Apteka
 public static void AddUser(User user)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         con.Users.InsertOnSubmit(user);
         con.SubmitChanges();
     }
 }
예제 #2
0
파일: Admin.cs 프로젝트: vitsv/Apteka
 public static void AddLek(Lek lek)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         con.Leks.InsertOnSubmit(lek);
         con.SubmitChanges();
     }
 }
예제 #3
0
파일: Admin.cs 프로젝트: vitsv/Apteka
  public static void DeleteUser(User user)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         User us = (from u in con.Users where u.UsersId == user.UsersId select u).FirstOrDefault();
         con.Users.DeleteOnSubmit(us);
         con.SubmitChanges();
     }
 }
예제 #4
0
파일: Admin.cs 프로젝트: vitsv/Apteka
 public static void DeleteLek(Lek lek)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         Lek lk = (from l in con.Leks where l.LekID == lek.LekID select l).FirstOrDefault();
         con.Leks.DeleteOnSubmit(lk);
         con.SubmitChanges();
     }
 }
예제 #5
0
파일: Admin.cs 프로젝트: vitsv/Apteka
 public static void EditUser(User user)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         User us = (from u in con.Users where u.UsersId == user.UsersId select u).FirstOrDefault();
         us.Nazwa_uzytkownika = user.Nazwa_uzytkownika;
         us.Haslo = user.Haslo;
         us.Prawo = user.Prawo;
         con.SubmitChanges();
     }
 }
예제 #6
0
파일: Admin.cs 프로젝트: vitsv/Apteka
 public static void UpdateLek(Lek lek)
 {
     using (AptekaDataDataContext con = new AptekaDataDataContext())
     {
         Lek lk = (from l in con.Leks where l.LekID == lek.LekID select l).FirstOrDefault();
         lk.Nazwa = lek.Nazwa;
         lk.M_nazwa = lek.M_nazwa;
         lk.KategorieID = lek.KategorieID;
         lk.PostacID = lek.PostacID;
         lk.Cena = lek.Cena;
         lk.Cena_hutowa = lek.Cena_hutowa;
         lk.Refundacja = lek.Refundacja;
         lk.Data_waznosci = lek.Data_waznosci;
         lk.Dawka = lek.Dawka;
         lk.Opakowanie = lek.Opakowanie;
         lk.Promocja = lek.Promocja;
         lk.Ilosc = lek.Ilosc;
         con.SubmitChanges();
     }
 }
예제 #7
0
        private void Realizuj_Click(object sender, RoutedEventArgs e)
        {
            using (AptekaDataDataContext con = new AptekaDataDataContext())
            {

                //try
               // {
                    Dostawa dost = new Dostawa();
                    Lek lektmp = new Lek();
                    dost.Data_zam = DateTime.Today;
                    dost.Data_realizacji = DateTime.Today;
                    con.Dostawas.InsertOnSubmit(dost);
                    con.SubmitChanges();
                    for (int i = 0; i <= ile - 1; i++)
                    {
                        lektmp = (from l in con.Leks where l.LekID == lista[i].lekitem.LekID select l).FirstOrDefault();
                        lektmp.Ilosc = lektmp.Ilosc + lista[i].ile;
                        con.SubmitChanges();
                        Dost_ilosc di = new Dost_ilosc();
                        di.LekID = lista[i].lekitem.LekID;
                        di.DostawaID = dost.DostawaID;
                        di.Ilosc = lista[i].ile;
                        con.Dost_iloscs.InsertOnSubmit(di);
                        con.SubmitChanges();
                    }
                    MessageBox.Show("Dostawa została zrealizowana!");
                    DialogResult = true;
               /* }
                catch
                {
                    MessageBox.Show("Wystapił bląd pod czas łaczenia sie z bazą!");
                    DialogResult = false;
                }*/
            }
        }
예제 #8
0
        private void Realizuj_Click(object sender, RoutedEventArgs e)
        {
            using (AptekaDataDataContext con = new AptekaDataDataContext())
            {

                //try
               // {
                    Zamowienie zam = new Zamowienie();
                    Lek lektmp = new Lek();
                    zam.Suma = razem;
                    zam.Data_zam = DateTime.Today;
                    zam.KlientID = 100;
                    con.Zamowienies.InsertOnSubmit(zam);
                    con.SubmitChanges();
                    for (int i = 0; i <= ile - 1; i++)
                    {
                        lektmp = (from l in con.Leks where l.LekID == lista[i].lekitem.LekID select l).FirstOrDefault();
                        lektmp.Ilosc = lektmp.Ilosc - lista[i].ile;
                        con.SubmitChanges();
                        Zam_ilosc zi = new Zam_ilosc();
                        zi.LekID = lista[i].lekitem.LekID;
                        zi.ZamowienieID = zam.ZamowienieID;
                        zi.Ilosc = lista[i].ile;
                        con.Zam_iloscs.InsertOnSubmit(zi);
                        con.SubmitChanges();
                    }
                    MessageBox.Show("Zamówienia zostało zrealizowane!");
                    DialogResult = true;
               /* }
                catch
                {
                    MessageBox.Show("Wystapił bląd pod czas łaczenia sie z bazą!");
                    DialogResult = false;
                }*/
            }
        }