Exemple #1
0
 public void DeleteImprumut(string index, string IBAN)
 {
     using (LibraryDatabaseEntities context = new LibraryDatabaseEntities())
     {
         foreach (var i in context.Imprumuturis)
         {
             if (i.Id_client.ToString() == index && i.IBAN.ToString() == IBAN)
             {
                 context.Imprumuturis.Remove(i);
             }
         }
         context.SaveChanges();
     }
 }
Exemple #2
0
 public void AddAngajat(string nume, string prenume, string pass)
 {
     using (LibraryDatabaseEntities context = new LibraryDatabaseEntities())
     {
         var x     = new Angajati();
         int index = 0;
         foreach (var i in context.Angajatis)
         {
             index = int.Parse(i.Id.ToString());
         }
         index++;
         x.Id      = index;
         x.Nume    = nume;
         x.Prenume = prenume;
         x.Parola  = pass;
         context.Angajatis.Add(x);
         context.SaveChanges();
     }
 }
Exemple #3
0
 public void RegisterUser(string[] date)
 {
     using (LibraryDatabaseEntities context = new LibraryDatabaseEntities())
     {
         int index = 1;
         foreach (var i in context.Clientis)
         {
             index++;
         }
         //var row=context.Clientis.
         var row = new Clienti();
         row.Id         = index;
         row.Nume       = date[0].ToString();
         row.Prenume    = date[1].ToString();
         row.email      = date[2].ToString();
         row.CNP        = date[3].ToString();
         row.penalizari = "0";
         context.Clientis.Add(row);
         context.SaveChanges();
     }
 }
Exemple #4
0
        public string GetBook(string author)
        {
            string IBAN = "";

            using (LibraryDatabaseEntities context = new LibraryDatabaseEntities())
            {
                foreach (var i in context.Cartis)
                {
                    string x = i.Titlu.ToString() + " ";
                    if (x == author)
                    {
                        int var = int.Parse(i.InStoc.ToString());
                        var++;
                        i.InStoc = var;
                        //context.SaveChanges();
                        IBAN = i.IBAN.ToString();
                        break;
                    }
                }
                context.SaveChanges();
            }
            return(IBAN);
        }
Exemple #5
0
 public bool AddLoan(string index, string IBAN)
 {
     using (LibraryDatabaseEntities context = new LibraryDatabaseEntities())
     {
         int ind = 0;
         foreach (var i in context.Imprumuturis)
         {
             ind = int.Parse(i.Id.ToString());
         }
         ind++;
         var x = new Imprumuturi();
         x.Id         = ind;
         x.IBAN       = int.Parse(IBAN);
         x.Id_client  = int.Parse(index);
         ind          = 1;
         x.Id_angajat = ind.ToString();
         DateTime localDate = DateTime.Now;
         x.Data_Imprumut = localDate;
         context.Imprumuturis.Add(x);
         context.SaveChanges();
         return(true);
     }
     return(false);
 }