Exemplo n.º 1
0
        public void CreateItemTest()
        {
            Furnizor owner = new Furnizor();
            Item     prov  = new Item("TORJE", "Timotei", 15, 77, false, owner);

            Assert.IsNotNull(prov); //succes
        }
Exemplo n.º 2
0
 public Furnizor modificaFurnizor(Furnizor model)
 {
     db = new bazaDeDateContext();
     db.Entry(model).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(model);
 }
Exemplo n.º 3
0
        public void Display()
        {
            Furnizor prov = new Furnizor();
            Item     it   = new Item("Jane Eyre", "A book about a girl", 2.2M, 2, false, prov);

            Assert.AreEqual(it.Display, "Jane Eyre - $2.2 -> Total: 0"); //succes
        }
Exemplo n.º 4
0
        public void CalculProfitDepozitTest()
        {
            Furnizor    f     = new Furnizor();
            Item        item  = new Item("bla", "bla", 10, 7, false, f);
            Consignatie calcP = new Consignatie();

            Assert.AreEqual(0, calcP.CalculProfitDepozit(item)); //succes
        }
Exemplo n.º 5
0
        public Furnizor CreateFurnizor(string Nume, string Prenume)
        {
            var nume    = Nume;
            var prenume = Prenume;

            var furnizor = new Furnizor(nume, prenume);

            return(furnizor);
        }
Exemplo n.º 6
0
        public Furnizor CreateFurnizorWithPersonalComision(string Nume, string Prenume, double Comision)
        {
            var nume     = Nume;
            var prenume  = Prenume;
            var comision = Comision;

            var furnizor = new Furnizor(nume, prenume, comision);

            return(furnizor);
        }
Exemplo n.º 7
0
 public Furnizor adaugaFurnizor(Furnizor model)
 {
     //model.NumeFurnizor = NumeFurnizorTxt.Text.ToString();
     //model.CodFurnizor = CodFurnizorTxt.Text.ToString();
     //model.AdresaSediuSocial = AdresaSediuSocialTxt.Text.ToString();
     //model.AdresaDeLivrare = AdresaDeLivrareTxt.Text.ToString();
     //model.PersoanaDeContact = PersoanaDeContactTxt.Text.ToString();
     //model.Email = EmailTxtFurnizor.Text.ToString();
     db = new bazaDeDateContext();
     db.tabel_Furnizor.Add(model);
     db.SaveChanges();
     return(model);
 }
Exemplo n.º 8
0
        public Item CreateItem(string Title, string Descriere, decimal Pret, int NumberOfItems,
                               bool Duplicate, Furnizor Owner)
        {
            var title         = Title;
            var descriere     = Descriere;
            var pret          = Pret;
            var numberOfItems = NumberOfItems;
            var duplicate     = Duplicate;
            var owner         = Owner;

            var item = new Item(title, descriere, pret, numberOfItems, duplicate, owner);

            return(item);
        }
Exemplo n.º 9
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Furnizor = await _context.Furnizor.FirstOrDefaultAsync(m => m.ID == id);

            if (Furnizor == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 10
0
        public void ItemConstructor()
        {
            Depozit  depozit = new Depozit();
            Furnizor prov    = new Furnizor();

            depozit.Items.Add(new Item
            {
                Title         = "Jane Eyre",
                Descriere     = "A book about a girl",
                Pret          = 1.50M,
                NumberOfItems = 7,
                Owner         = prov
            });

            Assert.IsNotNull(depozit); //succes
        }
Exemplo n.º 11
0
        public async Task <ActionResult> Edit([Bind("FurnizorID,NumeFurnizor,Adresa,Telefon,Email")] Furnizor furnizor)
        {
            if (!ModelState.IsValid)
            {
                return(View(furnizor));
            }
            var    client   = new HttpClient();
            string json     = JsonConvert.SerializeObject(furnizor);
            var    response = await client.PutAsync($"{_baseUrl}/{furnizor.FurnizorID}",
                                                    new StringContent(json, Encoding.UTF8, "application/json"));

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            return(View(furnizor));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Furnizor = await _context.Furnizor.FindAsync(id);

            if (Furnizor != null)
            {
                _context.Furnizor.Remove(Furnizor);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 13
0
        //public Furnizor modificaFurnizor(Furnizor model)
        //{
        //    db = new bazaDeDateContext();
        //    Furnizor find = db.tabel_Furnizor.Find(model.NumeFurnizor);
        //    //db.Entry(model).State = System.Data.Entity.EntityState.Modified;
        //    //var result = db.tabel_Furnizor.Find(model.NumeFurnizor);
        //    //if(result== null)
        //    //{
        //    //    Furnizor k= new Furnizor();
        //    //    k.NumeFurnizor = "Not Found";
        //    //    return k;
        //    //}
        //    //db.tabel_Furnizor.AddOrUpdate(model);
        //    db.SaveChanges();
        //    return model;
        //}
        public Furnizor modificaFurnizor(Furnizor model)
        {
            db = new bazaDeDateContext();
            //String o = model.NumeFurnizor.ToString();
            var fur = db.tabel_Furnizor.FirstOrDefault(x => x.NumeFurnizor == model.NumeFurnizor);

            fur.CodFurnizor       = model.CodFurnizor;
            fur.AdresaSediuSocial = model.AdresaSediuSocial;
            fur.AdresaDeLivrare   = model.AdresaDeLivrare;
            fur.PersoanaDeContact = model.PersoanaDeContact;
            fur.Email             = model.Email;
            fur.AlteDetalii       = model.AlteDetalii;

            //fur.NumeFurnizor = model.NumeFurnizor;
            //fur.CodFurnizor = model.CodFurnizor;
            db.SaveChanges();
            return(model);
        }
Exemplo n.º 14
0
        public async Task <ActionResult> Delete([Bind("FurnizorID")] Furnizor furnizor)
        {
            try
            {
                var client = new HttpClient();
                HttpRequestMessage request =
                    new HttpRequestMessage(HttpMethod.Delete, $"{_baseUrl}/{furnizor.FurnizorID}")
                {
                    Content = new StringContent(JsonConvert.SerializeObject(furnizor), Encoding.UTF8, "application/json")
                };
                var response = await client.SendAsync(request);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, $"Unable to delete record:{ ex.Message}");
            }
            return(View(furnizor));
        }
Exemplo n.º 15
0
        public async Task <ActionResult> Create([Bind("FurnizorID,NumeFurnizor,Adresa,Telefon,Email")] Furnizor furnizor)
        {
            if (!ModelState.IsValid)
            {
                return(View(furnizor));
            }
            try
            {
                var    client   = new HttpClient();
                string json     = JsonConvert.SerializeObject(furnizor);
                var    response = await client.PostAsync(_baseUrl, new StringContent(json, Encoding.UTF8, "application/json"));

                if (response.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, $"Unable to create record:{ ex.Message}");
            }
            return(View(furnizor));
        }
Exemplo n.º 16
0
        public void CreateFurnizorComisionTest_toString()
        {
            Furnizor prov = new Furnizor("TORJE", "Timotei", .7);

            Assert.AreEqual(prov.toString, "TORJE Timotei - $0"); //succes
        }
Exemplo n.º 17
0
        public void CreateFurnizorTest()
        {
            Furnizor prov = new Furnizor("TORJE", "Timotei");

            Assert.IsNotNull(prov); //succes
        }
        public static void Initialize(PharmacyContext context)
        {
            context.Database.EnsureCreated();

            if (context.Categorii.Any())
            {
                return; // BD a fost creata anterior
            }

            var categorii = new Categorie[]
            {
                new Categorie {
                    NumeCategorie = "Durere"
                },
                new Categorie {
                    NumeCategorie = "Răceală şi gripă"
                },
                new Categorie {
                    NumeCategorie = "Cardiovascular"
                },
                new Categorie {
                    NumeCategorie = "Dermatologie"
                },
                new Categorie {
                    NumeCategorie = "Afecţiuni gastrointestinale"
                },
            };

            foreach (Categorie s in categorii)
            {
                context.Categorii.Add(s);
            }
            context.SaveChanges();

            var furnizori = new Furnizor[]
            {
                new Furnizor {
                    FurnizorID = 1, NumeFurnizor = "BAYER SRL", Adresa = "Şos Pipera nr 42, etajele: 1,16,17, România", Telefon = "0215295900", Email = "*****@*****.**"
                },
                new Furnizor {
                    FurnizorID = 2, NumeFurnizor = "TERAPIA SA", Adresa = "Str. Fabricii nr.124, România", Telefon = "0264501500", Email = "*****@*****.**"
                },
                new Furnizor {
                    FurnizorID = 3, NumeFurnizor = "ACTAVIS Group", Adresa = "Reykjavíkurvegi 76-78, ICELAND", Telefon = "3545503300", Email = "*****@*****.**"
                },
                new Furnizor {
                    FurnizorID = 4, NumeFurnizor = "RECKITT BENCKISER România SRL", Adresa = "Str. Grigore Alexandrescu, nr. 89-97, Et.5, Sector 1, România", Telefon = "0215296700", Email = "*****@*****.**"
                },
                new Furnizor {
                    FurnizorID = 5, NumeFurnizor = "S.C. BIOFARM SA", Adresa = "Str.Logofatul Tautu nr.99, sector 3, Romania", Telefon = "0213010600", Email = "*****@*****.**"
                },
            };

            foreach (Furnizor c in furnizori)
            {
                context.Furnizori.Add(c);
            }
            context.SaveChanges();

            var produse = new Produs[]
            {
                new Produs {
                    CategorieID = 1, FurnizorID = 1, NumeMedicament = "ASPIRIN", Doza = "20 compr x 500 mg", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 1, FurnizorID = 3, NumeMedicament = "ADAGIN", Doza = "10 cps x 400 mg", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 2, FurnizorID = 4, NumeMedicament = "NUROFEN", Doza = "100 ml", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 3, FurnizorID = 2, NumeMedicament = "ASPACARDIN", Doza = "39mg/12mg x 30 tb", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 5, FurnizorID = 4, NumeMedicament = "GAVISCON MENTOL", Doza = "200 ml", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 2, FurnizorID = 5, NumeMedicament = "BIXTONIM Xylo", Doza = "10 ml", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
                new Produs {
                    CategorieID = 2, FurnizorID = 2, NumeMedicament = "PARACETAMOL", Doza = "10 cps X 400 mg", Pret = 0, DataExpirare = DateTime.Parse("2020-12-22")
                },
            };

            foreach (Produs e in produse)
            {
                context.Produse.Add(e);
            }
            context.SaveChanges();

            var tipuri = new Tip[]
            {
                new Tip {
                    TipMedicament = "Comprimate"
                },
                new Tip {
                    TipMedicament = "Capsule"
                },
                new Tip {
                    TipMedicament = "Sirop"
                },
                new Tip {
                    TipMedicament = "Spray"
                },
                new Tip {
                    TipMedicament = "Picături"
                },
            };

            foreach (Tip p in tipuri)
            {
                context.Tipuri.Add(p);
            }
            context.SaveChanges();

            var formaproduse = new FormaProdus[]
            {
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "ASPIRIN").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Comprimate").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "ADAGIN").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Capsule").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "NUROFEN").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Sirop").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "ASPACARDIN").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Comprimate").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "GAVISCON MENTOL").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Sirop").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "BIXTONIM Xylo").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Spray").TipID
                },
                new FormaProdus {
                    ProdusID = produse.Single(c => c.NumeMedicament == "BIXTONIM Xylo").ProdusID, TipID = tipuri.Single(i => i.TipMedicament == "Picături").TipID
                },
            };

            foreach (FormaProdus pb in formaproduse)
            {
                context.FormaProduse.Add(pb);
            }
            context.SaveChanges();
        }
Exemplo n.º 19
0
        public void toString()
        {
            Furnizor prov = new Furnizor("TORJE", "Timotei");

            Assert.AreEqual(prov.toString, "TORJE Timotei - $0"); //succes
        }