Esempio n. 1
0
        public Medicamente GetMedicamentByIndex(int index)
        {
            try
            {
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;
                    int    contor = 0;

                    while ((line = sr.ReadLine()) != null)
                    {
                        Medicamente medicament = new Medicamente(line);
                        if (contor == index)
                        {
                            return(medicament);
                        }
                        contor++;
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }
            return(null);
        }
Esempio n. 2
0
        private int GetId()
        {
            int IdMedicament = ID_PRIMUL_MEDICAMENT;

            try
            {
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        Medicamente m = new Medicamente(line);
                        IdMedicament = m.IdMedicament + INCREMENT;
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(IdMedicament);
        }
Esempio n. 3
0
        public bool UpdateMedicament(Medicamente medicamentActualizat)
        {
            List <Medicamente> medicamente = GetMedicamente();
            bool actualizareCuSucces       = false;

            try
            {
                using (StreamWriter swFisierText = new StreamWriter(NumeFisier, false))
                {
                    foreach (Medicamente med in medicamente)
                    {
                        if (med.IdMedicament != medicamentActualizat.IdMedicament)
                        {
                            swFisierText.WriteLine(med.ConversieLaSir_PentruFisier());
                        }
                        else
                        {
                            swFisierText.WriteLine(medicamentActualizat.ConversieLaSir_PentruFisier());
                        }
                    }
                    actualizareCuSucces = true;
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(actualizareCuSucces);
        }
Esempio n. 4
0
        public Medicamente[] GetMedicamente(out int nrMedicamente)
        {
            Medicamente[] medicament = new Medicamente[NR_ALOCARE];

            try
            {
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;
                    nrMedicamente = 0;

                    while ((line = sr.ReadLine()) != null)
                    {
                        medicament[nrMedicamente++] = new Medicamente(line);
                        if (nrMedicamente == NR_ALOCARE)
                        {
                            Array.Resize(ref medicament, nrMedicamente + NR_ALOCARE);
                        }
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(medicament);
        }
Esempio n. 5
0
        // On use the button adds the input into the list and the file.
        private void btnAdauga_Click(object sender, EventArgs e)
        {
            ResetCuloareEtichete();

            ErrorCode codValidare = Validare(txtNume.Text, txtPret.Text);

            if (codValidare != ErrorCode.CORRECT)
            {
                MarcheazaIncorect(codValidare);
            }
            else
            {
                Medicamente m = new Medicamente(txtNume.Text, Convert.ToSingle(txtPret.Text));
                if (rdbRetetaDa.Checked == true)
                {
                    m.Reteta = rdbRetetaDa.Text;
                }
                else
                {
                    m.Reteta = rdbRetetaNu.Text;
                }
                m.Administrare = cbnAdministrare.Text;
                m.Varsta       = new List <string>();
                m.Varsta.AddRange(VarsteSelectate);


                adminMedicamente.AddMedicament(m);
                lblMesaj.Visible = true;
                lblMesaj.Text    = "Medicamentul a fost adaugat";

                ResetControale();
            }
            Numenume.medicamentes = adminMedicamente.GetMedicamente();
        }
Esempio n. 6
0
        private void btnFinishEdit_Click(object sender, EventArgs e)
        {
            ResetCuloareEtichete();
            ErrorCode codValidare = Validare(rtbEditNume.Text, rtbEditPret.Text);

            if (codValidare != ErrorCode.CORRECT)
            {
                MarcheazaIncorect(codValidare);
            }
            else
            {
                if (indexz >= 0)
                {
                    Medicamente m = new Medicamente(rtbEditNume.Text, Convert.ToSingle(rtbEditPret.Text));


                    m.IdMedicament = indexz + 1;
                    if (rdbEditDa.Checked == true)
                    {
                        m.Reteta = rdbEditDa.Text;
                    }
                    else
                    {
                        m.Reteta = rdbEditNu.Text;
                    }
                    m.Administrare = cmbAdministrare.Text;
                    m.Varsta       = new List <string>();
                    m.Varsta.AddRange(VarsteSelectate);
                    med = m;
                    this.Hide();
                }
            }
        }
Esempio n. 7
0
        public List <Medicamente> GetMedicamente()
        {
            List <Medicamente> medicamente = new List <Medicamente>();

            try
            {
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        Medicamente m = new Medicamente(line);
                        medicamente.Add(m);
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(medicamente);
        }
Esempio n. 8
0
 public Medicamente GetMedicament(string nume)
 {
     try
     {
         using (StreamReader sr = new StreamReader(NumeFisier))
         {
             string line;
             while ((line = sr.ReadLine()) != null)
             {
                 Medicamente medicament = new Medicamente(line);
                 if (medicament.Nume.Equals(nume))
                 {
                     return(medicament);
                 }
             }
         }
     }
     catch (IOException eIO)
     {
         throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
     }
     catch (Exception eGen)
     {
         throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
     }
     return(null);
 }
Esempio n. 9
0
        public static Medicamente EditareMedicament()
        {
            Console.WriteLine("Introduceti numele medicamentului: ");
            string nume = Console.ReadLine();

            Console.WriteLine("Introduceti pretul medicamentului: ");
            string pret = Console.ReadLine();

            Medicamente m = new Medicamente();

            m.SetPrice(pret);
            m.Name = nume;

            return(m);
        }
Esempio n. 10
0
        // Input name and search for it in the list , followed by displaying a text with the price of the drug , its name and type.
        private void btnCauta_Click(object sender, EventArgs e)
        {
            Numenume.medicamentes = adminMedicamente.GetMedicamente();
            Medicamente m = adminMedicamente.GetMedicament(txtNume.Text);

            if (m != null)
            {
                lblMesaj.Visible = true;
                lblMesaj.Text    = m.ConvertString();
            }
            else
            {
                lblMesaj.Visible = true;
                lblMesaj.Text    = "Medicamentul nu a fost gasit !";
            }
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            int   x;
            Meniu meniu = new Meniu();

            List <Pacient> listaPacienti = new List <Pacient>();

            listaPacienti.Add(new Pacient("2950622350067", "Popescu", "Ion", new Modele.Generic.Adresa("Timis", "Timisoara", "Salciei", 3), "preinfarct", new Modele.Generic.Data(6, 12, 2017)));
            listaPacienti.Add(new Pacient("2953475350067", "Ionescu", "Andreea", new Modele.Generic.Adresa("Timis", "Timisoara", "Plopi", 9), "ulcer", new Modele.Generic.Data(6, 8, 2017)));
            listaPacienti.Add(new Pacient("2950622763467", "Anghel", "Maria", new Modele.Generic.Adresa("Timis", "Timisoara", "Madrid", 10), "gripa", new Modele.Generic.Data(6, 7, 2017)));
            Pacienti lista = new Pacienti(listaPacienti);


            List <Ambulanta> listaAmbulante = new List <Ambulanta>();

            listaAmbulante.Add(new Ambulanta("VW", 2005, new Modele.Generic.NumarMasina("TM02WOW")));
            listaAmbulante.Add(new Ambulanta("Mercedes", 2000, new Modele.Generic.NumarMasina("TM02FXR")));
            listaAmbulante.Add(new Ambulanta("BMW", 2010, new Modele.Generic.NumarMasina("TM05PLS")));
            Ambulante listaAmb = new Ambulante(listaAmbulante);

            List <Angajat> listaAngajati = new List <Angajat>();

            listaAngajati.Add(new Angajat("29567342688", "Pop", "Ionel", new Modele.Generic.Adresa("Timis", "Timisoara", "Plop", 3), "manager", "Ionescu Maria"));
            listaAngajati.Add(new Angajat("29556742688", "Popovici", "Arthur", new Modele.Generic.Adresa("Timis", "Timisoara", "Sever Bocu", 20), "doctor", "Pop Ionel"));
            listaAngajati.Add(new Angajat("29567342688", "Meda", "Ana", new Modele.Generic.Adresa("Timis", "Timisoara", "Linitei", 3), "asistent", "Popovici Arthur"));
            Angajati listaAng = new Angajati(listaAngajati);

            List <Medicament> listaMedicamente = new List <Medicament>();

            listaMedicamente.Add(new Medicament(new Modele.Medicament.Furnizor("SC MED", new Modele.Generic.Adresa("Timis", "Timisoara", "Lazar", 2)), "Algocalmin", 200));
            listaMedicamente.Add(new Medicament(new Modele.Medicament.Furnizor("SC OSM", new Modele.Generic.Adresa("Timis", "Timisoara", "Maur", 23)), "Diazepam", 240));
            Medicamente listaMed = new Medicamente(listaMedicamente);

            List <Investigatie> investigatii = new List <Investigatie>();

            investigatii.Add(new Investigatie("2950622350067", new Analize(200, 100, 50)));
            investigatii.Add(new Investigatie("2953475350067", new Analize(300, 50, 20)));

            do
            {
                meniu.afisareMeniu();
                x = int.Parse(Console.ReadLine());
                meniu.selectareOptiune(x, lista, listaAmb, listaAng, listaMed, investigatii);
            } while (x != 0);
            Console.ReadLine();
        }
Esempio n. 12
0
 public void AddMedicament(Medicamente m)
 {
     try
     {
         using (StreamWriter swFisierText = new StreamWriter(NumeFisier, true))
         {
             swFisierText.WriteLine(m.ConversieLaSir_PentruFisier());
         }
     }
     catch (IOException eIO)
     {
         throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
     }
     catch (Exception eGen)
     {
         throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
     }
 }
Esempio n. 13
0
        // Select an index from the List and fills the text boxes with the information from that selected index
        private void lstAfisare_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetControale();
            Medicamente m = adminMedicamente.GetMedicamentByIndex(lstAfisare.SelectedIndex - 1);

            if (m != null)
            {
                lblID.Text           = m.IdMedicament.ToString();
                txtNume.Text         = m.Nume;
                txtPret.Text         = m.Pret.ToString();
                cbnAdministrare.Text = m.Administrare;
                if (m.Reteta == "Da")
                {
                    rdbRetetaDa.Checked = true;
                }
                else
                {
                    rdbRetetaNu.Checked = true;
                }

                foreach (var vrst in gpbVarsta.Controls)
                {
                    if (vrst is CheckBox)
                    {
                        var vrstBox = vrst as CheckBox;
                        foreach (String vst in m.Varsta)
                        {
                            if (vrstBox.Text == vst)
                            {
                                vrstBox.Checked = true;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        public Edit(ArrayList w)
        {
            InitializeComponent();
            this.Size          = new System.Drawing.Size(500, 500);
            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new System.Drawing.Point(700, 100);
            this.Font          = new Font("Arial", 9, FontStyle.Bold);
            this.ForeColor     = Color.Black;
            this.Text          = "Editare";

            sel.Width     = LATIME_CONTROL + 120;
            sel.Top       = 10;
            sel.Text      = "Selectati medicamentul din lista:";
            sel.ForeColor = Color.Black;
            sel.BackColor = Color.Transparent;
            this.Controls.Add(sel);

            Op_Text y = new Op_Text("abc.txt");

            w = y.GetMedicamente();



            ComboBox c1 = new ComboBox();

            c1.Location       = new Point(5, DIMENSIUNE_PAS_Y * 2);
            c1.Text           = "Alegeti...";
            c1.Width          = LATIME_CONTROL + 150;
            c1.DropDownHeight = 100;


            foreach (Medicamente l in w)
            {
                c1.Items.Add(l.infoComplet);
            }



            this.Controls.Add(c1);


            btnSel.Text     = "Selectati";
            btnSel.Width    = LATIME_CONTROL;
            btnSel.Location = new Point(320, DIMENSIUNE_PAS_Y * 2);
            this.Controls.Add(btnSel);
            btnSel.Click += OnButtonSelClicked;
            void OnButtonSelClicked(object sender, EventArgs e)
            {
                Label NewDen = new Label();

                NewDen.Width     = LATIME_CONTROL - 20;
                NewDen.Text      = "Denumire:";
                NewDen.BackColor = Color.Transparent;
                NewDen.Top       = DIMENSIUNE_PAS_Y * 3;
                this.Controls.Add(NewDen);

                Label NewPrice = new Label();

                NewPrice.Width     = LATIME_CONTROL - 20;
                NewPrice.Text      = "Pret:";
                NewPrice.BackColor = Color.Transparent;
                NewPrice.Top       = DIMENSIUNE_PAS_Y * 4;
                this.Controls.Add(NewPrice);

                TextBox txtNewDen = new TextBox();

                txtNewDen.Width    = LATIME_CONTROL;
                txtNewDen.Location = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 3);
                this.Controls.Add(txtNewDen);

                TextBox txtNewPrice = new TextBox();

                txtNewPrice.Width    = LATIME_CONTROL;
                txtNewPrice.Location = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 4);
                this.Controls.Add(txtNewPrice);

                Label newTip = new Label();

                newTip.Width     = LATIME_CONTROL - 20;
                newTip.Text      = "Tip:";
                newTip.Top       = DIMENSIUNE_PAS_Y * 5;
                newTip.BackColor = Color.Transparent;
                this.Controls.Add(newTip);

                CheckBox comp = new CheckBox();

                comp.Location  = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 5);
                comp.Text      = "Comprimat";
                comp.Width     = LATIME_CONTROL;
                comp.BackColor = Color.Transparent;
                this.Controls.Add(comp);

                CheckBox sir = new CheckBox();

                sir.Location  = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 6);
                sir.Text      = "Sirop";
                sir.BackColor = Color.Transparent;
                sir.Width     = LATIME_CONTROL;
                this.Controls.Add(sir);

                CheckBox ung = new CheckBox();

                ung.Location  = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 7);
                ung.Text      = "Unguent";
                ung.Width     = LATIME_CONTROL;
                ung.BackColor = Color.Transparent;
                this.Controls.Add(ung);

                Label newPres = new Label();

                newPres.Width     = LATIME_CONTROL - 20;
                newPres.Top       = DIMENSIUNE_PAS_Y * 8;
                newPres.Text      = "Prescriptie:";
                newPres.BackColor = Color.Transparent;
                this.Controls.Add(newPres);

                RadioButton Y = new RadioButton();

                Y.Location  = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 8);
                Y.Text      = "Da";
                Y.Width     = LATIME_CONTROL - 100;
                Y.BackColor = Color.Transparent;
                this.Controls.Add(Y);

                RadioButton N = new RadioButton();

                N.Location  = new Point(DIMENSIUNE_PAS_X + 15, DIMENSIUNE_PAS_Y * 8);
                N.Text      = "Nu";
                N.BackColor = Color.Transparent;
                N.Width     = LATIME_CONTROL;
                this.Controls.Add(N);

                Button btnSave = new Button();

                btnSave.Text = "Salvati";

                btnSave.Width    = LATIME_CONTROL;
                btnSave.Location = new Point(DIMENSIUNE_PAS_X - 35, DIMENSIUNE_PAS_Y * 9);
                this.Controls.Add(btnSave);
                btnSave.Click += OnButtonSaveClicked;
                void OnButtonSaveClicked(object sender, EventArgs e)
                {
                    int v = ValidareEdit();

                    if (v == 0)
                    {
                        string s1 = txtNewDen.Text;
                        double p  = Convert.ToDouble(txtNewPrice.Text);
                        int    t  = 0;
                        int    pr = 0;
                        if (comp.Checked == true)
                        {
                            t = 1;
                        }
                        else if (sir.Checked == true)
                        {
                            t = 2;
                        }
                        else if (ung.Checked == true)
                        {
                            t = 3;
                        }
                        if (Y.Checked == true)
                        {
                            pr = 1;
                        }
                        else if (N.Checked == true)
                        {
                            pr = 0;
                        }
                        Medicamente x = new Medicamente(s1, p, t, pr);

                        y.ModificaLinie("abc.txt", c1.SelectedIndex, x);
                    }
                    else
                    {
                        switch (v)
                        {
                        case 1:
                            NewDen.ForeColor = Color.Red;
                            break;

                        case 2:
                            NewPrice.ForeColor = Color.Red;
                            break;

                        case 3:
                            newTip.ForeColor = Color.Red;
                            break;

                        case 4:
                            newPres.ForeColor = Color.Red;
                            break;
                        }
                    }
                }

                int ValidareEdit()
                {
                    if (txtNewDen.Text == string.Empty || txtNewDen.Text.Length > LUNGIME_MAX)
                    {
                        return(1);
                    }
                    else if (txtNewPrice.Text == string.Empty || Convert.ToDouble(txtNewPrice.Text) < PRET_MIN)
                    {
                        return(2);
                    }
                    else if ((comp.Checked == true && sir.Checked == true && ung.Checked == true) || (sir.Checked == false && ung.Checked == false && comp.Checked == false))
                    {
                        return(3);
                    }

                    else if (Y.Checked == false && N.Checked == false)
                    {
                        return(4);
                    }


                    return(0);
                }
            }
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            Medicamente[] med;
            IStocareData  adminMedicamente = StocareFactory.GetAdministratorStocare();
            int           nrMedicamente;

            med = adminMedicamente.GetMedicamente(out nrMedicamente);
            Medicamente.IdUltimMedicament = nrMedicamente;

            bool validare = true;

            while (validare)
            {
                Console.Clear();
                Console.WriteLine("1.Adaugare medicament.");
                Console.WriteLine("2.Stergere medicament.");
                Console.WriteLine("3.Editare medicament.");
                Console.WriteLine("4.Afisare lista medicamente.");
                Console.WriteLine("5.Cautare medicament.");
                Console.WriteLine("6.Tema3_1 adauga medicament.");
                Console.WriteLine("7.Compara pretul a 2 medicamente.");
                Console.WriteLine("X.Iesire.");
                Console.WriteLine("\nSelectati o optiune : ");


                switch (Console.ReadLine())
                {
                case "1":
                    Medicamente m = CitireMedicament();
                    med[nrMedicamente] = m;
                    adminMedicamente.AddMedicament(m);                  //adauga medicamentul in fisierul text
                    #region OLD_CODE_ADD
                    //med[nrMedicamente - 1] = new Medicamente();
                    //Console.WriteLine("Introduceti numele medicamentului pe care doriti sa-l adaugati: ");
                    //med[nrMedicamente - 1].Name = Console.ReadLine();
                    //Console.WriteLine("Introduceti pretului produsului {0}", med[nrMedicamente - 1].Name);
                    //med[nrMedicamente - 1].SetPrice(Convert.ToInt32(Console.ReadLine()));
                    //Console.WriteLine("Ati adaugat medicamentul {0} la pretul de {1} lei", med[nrMedicamente - 1].Name, med[nrMedicamente - 1].Price);
                    nrMedicamente++;
                    //Console.ReadKey();
                    #endregion
                    break;

                case "2":
                    AfisareMedicamente(med, nrMedicamente);
                    Console.WriteLine("Alegeti numarul medicamentului din lista pe care doriti sa-l stergeti : ");
                    int indice = Convert.ToInt32(Console.ReadLine());
                    med[indice - 1].Name = string.Empty;
                    med[indice - 1].SetPrice(string.Empty);
                    //med[indice - 1].Price = null;
                    Console.ReadKey();
                    break;

                case "3":
                    AfisareMedicamente(med, nrMedicamente);
                    Console.WriteLine("Alegeti numarul medicamentului din lista pe care doriti sa-l editati : ");
                    int         ind   = Convert.ToInt32(Console.ReadLine());
                    Medicamente medit = CitireMedicament();
                    med[ind - 1] = medit;
                    adminMedicamente.EditMedicament(med, ind);
                    #region cod vechi
                    //Medicamente m1 = EditareMedicament();
                    //med[ind - 1] = m1;
                    //adminMedicamente.AddMedicament(m1);
                    //Console.WriteLine("Ati ales sa editati medicamentul {0} .", med[ind - 1].Name);
                    //Console.WriteLine("Alegeti un nume : ");
                    //med[ind - 1].Name = Console.ReadLine();
                    //Console.WriteLine("Alegeti un pret : ");
                    //med[ind - 1].SetPrice(Console.ReadLine());
                    //Console.WriteLine("Nou : {0}",med[ind-1].ConvertString());
                    //Medicamente editare = new Medicamente();
                    //med[ind - 1] = editare;
                    //adminMedicamente.AddMedicament(editare);
                    #endregion
                    Console.ReadKey();
                    break;

                case "4":
                    AfisareMedicamente(med, nrMedicamente);
                    #region OLD_CODE_Afisare
                    //for (int i=0;i<nrMedicamente-1;i++)
                    //{
                    //    Console.WriteLine("{0} . {1} pret: {2} lei", i + 1, m1[i].Name, m1[i].Price);
                    //}
                    #endregion
                    Console.ReadKey();
                    break;

                case "5":
                    CautareMedicament(med, nrMedicamente);
                    Console.ReadKey();
                    break;

                case "6":
                    Console.WriteLine("Introduceti numele si pretul pe aceeasi linie cu , intre ele");
                    string      tema3_1 = Console.ReadLine();
                    Medicamente tema3   = new Medicamente(tema3_1, 3);
                    Console.WriteLine(tema3.ConvertString());
                    Console.ReadKey();
                    break;

                case "7":
                    Console.WriteLine(med[0].CompararePret(med[1]));
                    Console.ReadKey();
                    break;

                case "X":
                    validare = false;
                    break;

                default:

                    break;
                }
            }
        }
Esempio n. 16
0
 public bool UpdateMedicament(Medicamente m)
 {
     throw new Exception("Optiunea UpdateMedicament nu este implementata");
 }
Esempio n. 17
0
 public void AddMedicament(Medicamente m)
 {
     throw new Exception("Optiunea AddMedicament nu este implementata");
 }
Esempio n. 18
0
        private void OnButtonAdaugaClicked(object sender, EventArgs e)
        {
            int validare = Validare();



            if (validare == 0)

            {
                nrMed++;
                Denumire.ForeColor = Color.LimeGreen;
                Pret.ForeColor     = Color.LimeGreen;
                Tip.ForeColor      = Color.LimeGreen;
                Pres.ForeColor     = Color.LimeGreen;

                int ty = 0, prt = 0;
                if (comp1.Checked == true)
                {
                    ty = 1;
                }
                else if (sir1.Checked == true)
                {
                    ty = 2;
                }
                else if (ung1.Checked == true)
                {
                    ty = 3;
                }
                if (Y1.Checked == true)
                {
                    prt = 1;
                }
                else if (N1.Checked == true)
                {
                    prt = 0;
                }


                Medicamente m = new Medicamente(txtDenumire.Text, Convert.ToDouble(txtPret.Text), ty, prt);
                lstAfisare.Items.Clear();
                lstAfisare.Items.Add(nrMed + "." + m.Afisare());
                Op_Text x1 = new Op_Text("abc.txt");
                x1.AddMedicament(m);
            }
            else
            {
                switch (validare)
                {
                case 1:
                    Denumire.ForeColor = Color.Red;
                    break;

                case 2:
                    Pret.ForeColor = Color.Red;
                    break;

                case 3:
                    Tip.ForeColor = Color.Red;
                    break;

                case 4:
                    Pres.ForeColor = Color.Red;
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 19
0
        public void selectareOptiune(int x, Pacienti pacienti, Ambulante ambulante, Angajati angajati, Medicamente medicamente, List <Investigatie> investigatii)
        {
            switch (x)
            {
            case 0: break;

            case 1:
                Console.Write(ambulante.ToString());
                Console.Write("\n\n");
                break;

            case 2:
                Console.Write(angajati.ToString());
                Console.Write("\n\n");
                break;

            case 3: Console.Write("Dati CNP:\n");
                string cnp = Console.ReadLine();
                foreach (var inv in investigatii)
                {
                    if (inv.Cnp.Equals(cnp))
                    {
                        Console.Write(inv.ToString());
                    }
                }
                break;

            case 4:
                Console.Write(medicamente.ToString());
                Console.Write("\n\n");
                break;

            case 5:
                Console.Write(pacienti.ToString());
                Console.Write("\n\n");
                break;

            case 6:
                List <string>        content = new List <string>();
                GeneratorRapoartePdf pdf     = new GeneratorRapoartePdf();
                Console.Write("Dati CNP:\n");
                string cnp2 = Console.ReadLine();
                foreach (Pacient pac in pacienti._pacienti)
                {
                    if (pac.Cnp == cnp2)
                    {
                        content.Add(pac.ToString());
                    }
                }
                foreach (var inv in investigatii)
                {
                    if (inv.Cnp.Equals(cnp2))
                    {
                        content.Add(inv.ToString());
                    }
                }
                pdf.GenerareRaportTabelar(cnp2 + ".pdf", content);


                break;
            }
        }