Beispiel #1
0
        private void connect_bttn_Click(object sender, RoutedEventArgs e)
        {
            OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["IstorieAccesDB"].ConnectionString.ToString());

            try
            {
                conn.Open();
                OleDbCommand comanda = new OleDbCommand("select count(*) from Utilizatori where Nume_user=@nume and Pass_user=@parola ", conn);
                comanda.Parameters.AddWithValue("@nume", numeUtilizator.Text);
                comanda.Parameters.AddWithValue("@parola", parolaUtilizator.Text);
                int exista = int.Parse(comanda.ExecuteScalar().ToString());
                if (exista > 0)
                {
                    MeniuPrincipal form = new MeniuPrincipal();
                    this.Hide();
                    form.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Parola sau nume gresit");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
Beispiel #2
0
 private void connect_bttn_Click(object sender, RoutedEventArgs e)
 {
     using (IstorieEntities context = new IstorieEntities())
     {
         var query = (from c in context.Users
                      where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Text
                      select c).Count();
         if (query > 0)
         {
             MeniuPrincipal form = new MeniuPrincipal();
             this.Hide();
             form.ShowDialog();
             this.Close();
         }
         else
         {
             MessageBox.Show("Nume de utilizator sau parola gresita.");
         }
     }
 }
Beispiel #3
0
 private void connect_bttn_Click(object sender, RoutedEventArgs e)
 {
     using (IstorieEntities context = new IstorieEntities())
     {
         var user = (from c in context.Users
                     where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Password
                     select c).FirstOrDefault();
         if (user != null)
         {
             UserActual.user = (User)user;
             MeniuPrincipal form = new MeniuPrincipal();
             this.Hide();
             form.ShowDialog();
             this.Close();
         }
         else
         {
             MessageBox.Show("Nume de utilizator sau parola gresita.");
         }
     }
 }
Beispiel #4
0
        private void TimerLogin_Tick(object sender, EventArgs e)
        {
            timerLogin.Stop();
            Hide();

            using (SoundPlayer audio = new SoundPlayer(bitQuiz.Properties.Resources.booop))
            {
                audio.Play();

                if (rol == 1)
                {
                    MeniuPrincipal mp = new MeniuPrincipal();
                    mp.ShowDialog();
                }
                else
                {
                    Admin admin = new Admin();
                    admin.ShowDialog();
                }
                Close();
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            //hardcoded patient 1
            var cnpPacient  = "0123456789";
            var numePacient = new NumeIntreg("Ana", "David");
            var sex         = "F ";
            var dataNastere = new Data(7, 3, 1995);
            var adresa      = new Adresa("Timis", "Timisoara", "Timocului", 1);
            var ocupatie    = "student";
            var locMunca    = "Firma1";

            //hardcoded patient 2
            var cnpPacient2  = "1234567890";
            var numePacient2 = new NumeIntreg("Denis", "Iulian");
            var sex2         = "M ";
            var dataNastere2 = new Data(11, 10, 1995);
            var adresa2      = new Adresa("Timis", "Timisoara", "Marasti", 20);
            var ocupatie2    = "contabil";
            var locMunca2    = "Firma2";

            //creeaza pacient
            var pacient1 = PacientFactory.Instance.creeazaPacient(cnpPacient, numePacient, sex, dataNastere, adresa, ocupatie, locMunca);
            //Console.WriteLine(pacient1.toString());

            //creeaza pacient 2
            var pacient2 = PacientFactory.Instance.creeazaPacient(cnpPacient2, numePacient2, sex2, dataNastere2, adresa2, ocupatie2, locMunca2);
            //Console.WriteLine(pacient2.toString());

            //for every hardcoded patient, generate his pdf file with personal data
            string pathPDF1          = @"DatePacient-" + pacient1.cnp + ".pdf";
            string pathPDF2          = @"DatePacient-" + pacient2.cnp + ".pdf";
            var    generatorFisaDate = new FisaDateIdentificare();

            generatorFisaDate.GenerareFisa(pacient1, pathPDF1);
            generatorFisaDate.GenerareFisa(pacient2, pathPDF2);


            //afisare lista pacienti
            //Console.WriteLine("TOTI DIN LISTA");
            //foreach(Pacient p in Pacient.listaPacienti)
            //{
            //    Console.WriteLine(p.cnp);
            //}

            //afisare cnp pacienti
            Console.WriteLine("cnp pacienti existenti");
            foreach (Pacient p in Pacient.listaPacienti)
            {
                Console.WriteLine(p.cnp);
            }

            //MENIU

            int optiune = 0;

            do
            {
                var          meniu = new MeniuPrincipal();
                CautaPacient cautaPacient;
                int          gasit     = 0;
                string       pathPDF   = "";
                string       cnpCautat = "";

                Console.WriteLine("\nAlegeti o optiune: \n");
                optiune = Convert.ToInt16(Console.ReadLine());

                switch (optiune)
                {
                case 0: break;

                case 1:     //adaugare pacient
                    var     meniuAdaugare = new MeniuSecundar();
                    Pacient pacientNou    = meniuAdaugare.MeniuAdaugarePacient();
                    Pacient.listaPacienti.Add(pacientNou);

                    pathPDF = @"DatePacient-" + pacientNou.cnp + ".pdf";
                    var generator = new FisaDateIdentificare();
                    generator.GenerareFisa(pacientNou, pathPDF);

                    break;

                case 2:     //vizualizare fisa date personale
                    var meniuDate = new MeniuSecundar();
                    var cnp       = meniuDate.MeniuFisaPersonala();

                    cautaPacient = new CautaPacient();
                    gasit        = cautaPacient.Cauta(cnp);

                    if (gasit == 1)
                    {
                        pathPDF = @"DatePacient-" + cnp + ".pdf";

                        var pdfDoc = new DeschidePDF(pathPDF);
                    }
                    else
                    {
                        Console.WriteLine("cnp-ul cautat nu este inregistrat");
                    }

                    break;

                case 3:    //vizualizare istoric
                    Console.WriteLine("Dati cnp-ul pacientului cautat:");
                    cnpCautat = Console.ReadLine();

                    pathPDF = @"Istoric" + cnpCautat + ".pdf";

                    cautaPacient = new CautaPacient();
                    gasit        = cautaPacient.Cauta(cnpCautat);
                    if (gasit == 1)
                    {
                        var pacientGasit3 = cautaPacient.PacientGasit(cnpCautat);

                        if (pacientGasit3.istoricExistent == 1)
                        {
                            var docIstoric = new IstoricPacient();
                            docIstoric.GenerareFisa(pacientGasit3, pathPDF);
                            var pdfDoc3 = new DeschidePDF(pathPDF);
                        }
                        else
                        {
                            Console.WriteLine("pacientul nu are istoric");
                        }
                    }


                    break;

                case 4:    //generare docuemnt

                    Console.WriteLine("Dati cnp-ul pacientului cautat.");
                    cnpCautat = Console.ReadLine();

                    //cauta pacient
                    cautaPacient = new CautaPacient();
                    gasit        = cautaPacient.Cauta(cnpCautat);
                    var pacientGasit = new Pacient();

                    if (gasit == 1)
                    {
                        pacientGasit = cautaPacient.PacientGasit(cnpCautat);
                    }

                    var meniu4 = new MeniuSecundar();
                    var doc4   = Convert.ToInt16(meniu4.MeniuGenerareDocumente());

                    switch (doc4)
                    {
                    case 1:         //adeverinta medicala

                        var generareDoc = new GenerareDoc();
                        generareDoc.AlegeTipulDocumentului("adeverinta medicala", cnpCautat);

                        //se adauga in dictionar pentru a ramane in istoricul pacientului datele
                        // pacientGasit.afectiuneRecomandare.Add()

                        break;

                    case 2:         //reteta

                        var generareDocReteta = new GenerareDoc();
                        generareDocReteta.AlegeTipulDocumentului("reteta", cnpCautat);

                        break;
                    }
                    break;
                }
            } while (optiune != 0);
            //Console.Read();
        }