예제 #1
0
        public static List <Lekar> GetLekari()
        {
            ISession     session = SessionManager.GetSession();
            List <Lekar> lekari  = new List <Lekar>();

            if (session == null)
            {
                return(null);
            }

            var lekariData = session.Execute("select * from \"Lekar\"");


            foreach (var lekarData in lekariData)
            {
                Lekar lekar = new Lekar();
                lekar.JMBG                  = lekarData["JMBG"] != null ? lekarData["JMBG"].ToString() : string.Empty;
                lekar.ime                   = lekarData["ime"] != null ? lekarData["ime"].ToString() : string.Empty;
                lekar.prezime               = lekarData["prezime"] != null ? lekarData["prezime"].ToString() : string.Empty;
                lekar.adresa                = lekarData["adresa"] != null ? lekarData["adresa"].ToString() : string.Empty;
                lekar.specijalizacija       = lekarData["specijalizacija"] != null ? lekarData["specijalizacija"].ToString() : string.Empty;
                lekar.IDzdravstveneUstanove = lekarData["IDzdravstveneUstanove"] != null ? lekarData["IDzdravstveneUstanove"].ToString() : string.Empty;
                lekar.IDodeljenja           = lekarData["IDodeljenja"] != null ? lekarData["IDodeljenja"].ToString() : string.Empty;

                lekari.Add(lekar);
            }


            return(lekari);
        }
예제 #2
0
        public static Lekar GetLekar(string jmbg)
        {
            ISession session = SessionManager.GetSession();
            Lekar    lekar   = new Lekar();

            if (session == null)
            {
                return(null);
            }

            Row lekarData = session.Execute("select * from \"Lekar\" where \"JMBG\"='" + jmbg + "'").FirstOrDefault();

            if (lekarData != null)
            {
                lekar.JMBG                  = lekarData["JMBG"] != null ? lekarData["JMBG"].ToString() : string.Empty;
                lekar.ime                   = lekarData["ime"] != null ? lekarData["ime"].ToString() : string.Empty;
                lekar.prezime               = lekarData["prezime"] != null ? lekarData["prezime"].ToString() : string.Empty;
                lekar.adresa                = lekarData["adresa"] != null ? lekarData["adresa"].ToString() : string.Empty;
                lekar.specijalizacija       = lekarData["specijalizacija"] != null ? lekarData["specijalizacija"].ToString() : string.Empty;
                lekar.IDzdravstveneUstanove = lekarData["IDzdravstveneUstanove"] != null ? lekarData["IDzdravstveneUstanove"].ToString() : string.Empty;
                lekar.IDodeljenja           = lekarData["IDodeljenja"] != null ? lekarData["IDodeljenja"].ToString() : string.Empty;
            }

            return(lekar);
        }
예제 #3
0
        public TerminUdz(Lekar lekar)
        {
            this.lekar = lekar;


            InitializeComponent();
        }
예제 #4
0
 public ActionResult Create([Bind(Include = "Prezime,Ime,DatumZaposlenja,Email")] Lekar lekar, HttpPostedFileBase upload) //Sklonjen ID - auto..
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (upload != null && upload.ContentLength > 0)//
             {
                 var foto = new File
                 {
                     FileName    = System.IO.Path.GetFileName(upload.FileName),
                     FileType    = FileType.Foto,
                     ContentType = upload.ContentType
                 };
                 using (var reader = new System.IO.BinaryReader(upload.InputStream))
                 {
                     foto.Content = reader.ReadBytes(upload.ContentLength);
                 }
                 lekar.Files = new List <File> {
                     foto
                 };
             }
             db.Lekari.Add(lekar);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(lekar));
 }
예제 #5
0
        public DoktorAddEdit(Lekar korisnik, Stanje stanje = Stanje.DODAVANJE)
        {
            InitializeComponent();

            this.korisnik = korisnik;
            this.stanje   = stanje;

            tbPol.ItemsSource = Enum.GetValues(typeof(EPol)).Cast <EPol>();
            Random random = new Random();

            //      korisnik.ID = random.Next(1, 1000);
            korisnik.Aktivan          = true;
            tbLozinka.DataContext     = korisnik;
            tbIme.DataContext         = korisnik;
            tbEmail.DataContext       = korisnik;
            tbIme.DataContext         = korisnik;
            tbJmbg.DataContext        = korisnik;
            tbPol.DataContext         = korisnik;
            tbPrezime.DataContext     = korisnik;
            tbPol.DataContext         = korisnik;
            korisnik.AdresaID         = 847;
            korisnik.DomZdravljaID    = 390;
            tbAdresa.DataContext      = korisnik;
            tbDomZdravlja.DataContext = korisnik;
        }
예제 #6
0
        public void updateUser1(object obj)
        {
            Lekar lekar = obj as Lekar;

            using (SqlConnection conn = new SqlConnection(Util.CONNECTION_STRING))
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = @"update Doktori
                                        SET ime = @ime,
                                             prezime = @prezime,
                                              lozinka = @lozinka,
                                               email = @email,
                                               pol = @pol,
                                               aktivan = @aktivan,
                                            adresa_id = @adresa_id,
                                            domZdravlja_id = @domZdravlja_id
                                        where id = @id";

                command.Parameters.Add(new SqlParameter("id", lekar.ID));
                command.Parameters.Add(new SqlParameter("ime", lekar.Ime));
                command.Parameters.Add(new SqlParameter("prezime", lekar.Prezime));
                command.Parameters.Add(new SqlParameter("lozinka", lekar.Lozinka));
                command.Parameters.Add(new SqlParameter("email", lekar.Email));
                command.Parameters.Add(new SqlParameter("pol", lekar.Pol));
                command.Parameters.Add(new SqlParameter("aktivan", lekar.Aktivan));
                command.Parameters.Add(new SqlParameter("adresa_id", lekar.AdresaID));
                command.Parameters.Add(new SqlParameter("domZdravlja_id", lekar.DomZdravljaID));


                command.ExecuteScalar();
            }
        }
예제 #7
0
        public int saveUser(object obj)
        {
            Lekar  lekar  = obj as Lekar;
            Random random = new Random();

            using (SqlConnection conn = new SqlConnection(Util.CONNECTION_STRING))
            {
                conn.Open();
                SqlCommand command = conn.CreateCommand();
                command.CommandText = @"insert into Doktori (id,ime,prezime,lozinka,email,jmbg,pol,aktivan,adresa_id,domZdravlja_id)
                                        output inserted.id VALUES (@id,@ime,@prezime,@lozinka,@email,@jmbg,@pol,@aktivan,@adresa_id,@domZdravlja_id)";
                command.Parameters.Add(new SqlParameter("id", lekar.ID = random.Next(1, 1000)));
                command.Parameters.Add(new SqlParameter("ime", lekar.Ime));
                command.Parameters.Add(new SqlParameter("prezime", lekar.Prezime));
                command.Parameters.Add(new SqlParameter("lozinka", lekar.Lozinka));
                command.Parameters.Add(new SqlParameter("email", lekar.Email));
                command.Parameters.Add(new SqlParameter("jmbg", lekar.JMBG));
                command.Parameters.Add(new SqlParameter("pol", EPol.M));
                command.Parameters.Add(new SqlParameter("aktivan", lekar.Aktivan));
                command.Parameters.Add(new SqlParameter("adresa_id", lekar.AdresaID));
                command.Parameters.Add(new SqlParameter("domZdravlja_id", lekar.DomZdravljaID));

                return((int)command.ExecuteScalar());
            }
        }
        private bool CustomFilter(object obj)
        {
            Lekar korisnik = obj as Lekar;

            // Korisnik korisnik1 = (Korisnik)obj;

            if (korisnik.Aktivan)
            {
                if (TxtPretraga.Text != "")
                {
                    if (korisnik.Ime.Contains(TxtPretraga.Text))
                    {
                        return(korisnik.Ime.Contains(TxtPretraga.Text));
                    }
                    if (korisnik.Prezime.Contains(TxtPretraga.Text))
                    {
                        return(korisnik.Prezime.Contains(TxtPretraga.Text));
                    }
                    if (korisnik.Email.Contains(TxtPretraga.Text))
                    {
                        return(korisnik.Email.Contains(TxtPretraga.Text));
                    }
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #9
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            using (LogInForm login = new LogInForm(client, _bolnica.ime))
            {
                if (dgvLekari.SelectedRows.Count > 0)
                {
                    login.username = dgvLekari.SelectedRows[0].Cells[4].Value.ToString();
                }

                //String enPassword = Password.Encrypt("1234", Form1.passKey);
                //String denPassword = Password.Decrypt(enPassword, Form1.passKey);

                var result = login.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _lekar = login.res1 as Lekar;
                    var pom = login.res2 as Radi;
                    _lekar.radi_u(_bolnica, pom.odeljenje);

                    groupLekari.Visible = false;
                    tbInfoLekar.Text    = _lekar.ToString();
                    tbInfoLekar.Visible = true;
                    btnLogOut.Visible   = true;

                    dgvCekaonica.Columns[5].Visible       = true;
                    dgvHospitalizovani.Columns[5].Visible = true;
                    cbBolnice.Enabled        = false;
                    btnIzabraniLekar.Enabled = true;
                }
            }
        }
예제 #10
0
        public LekariZakazivanje(Termin termin, Lekar lekar)
        {
            InitializeComponent();
            this.termin = termin;



            //BUG SA DATUMOM - ne radi odabir datuma tjst ne prolazi select.


            Random random = new Random();

            termin.Status     = EStatusTermina.SLOBODAN;
            termin.Aktivan    = true;
            termin.Datum      = DateTime.Now;
            termin.PacijentID = 100;
            termin.LekarID    = lekar.ID;
            // termin.LekarID = 14;
            //   termin.PacijentID = 323;
            //  tbSifra.DataContext = termin;
            //    tbLekar1.DataContext = termin;
            dpDatum.DataContext = termin;
            //   tbLekar1.DataContext = termin;
            //   tbPacijent.DataContext = termin;
        }
예제 #11
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Lekar         novLekar = new Lekar();
            DoktorAddEdit few      = new DoktorAddEdit(novLekar);

            //     Util.Instance.CitanjeEntiteta();
            few.ShowDialog();
        }
예제 #12
0
        private void cbLekari_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Lekar lekar = (Lekar)cbLekari.SelectedItem;

            termini = termini.Where(t => t.VrstaPregleda.Lekar.LekarID == lekar.LekarID).ToList();
            dgvTermini.DataSource = termini;
            termini = Communication.Communication.Instance.PrikaziTermine();
        }
예제 #13
0
        public async Task UpisiLekara(int IDB, [FromBody] Lekar lekar)
        {
            var bol = await Context.Bolnice.FindAsync(IDB);

            lekar.Bolnica = bol;
            Context.Lekari.Add(lekar);
            await Context.SaveChangesAsync();
        }
예제 #14
0
        public void deleteUser(string username)
        {
            Lekar k = Util.Instance.Lekari.ToList().Find(Lekar => Lekar.JMBG.Equals(username));

            k.Aktivan = false;
            //   if (k == null)
            // throw new UserNotFoundException($"Ne postoji korisnik sa korisnickim imenom {username}");
            updateUser(k);
        }
예제 #15
0
        public int addLekar(Lekar lekar)
        {
            string sql = "INSERT INTO podaci (ImePrezime) Values (@imePrezime); " +
                         " SELECT last_insert_rowid()";

            using (IDbConnection db = new SQLiteConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString))
            {
                var affectedRows = db.Query <int>(sql, new { lekar.ImePrezime });
                return(affectedRows.Single());
            }
        }
예제 #16
0
 private void btnLogOut_Click(object sender, EventArgs e)
 {
     _lekar = null;
     groupLekari.Visible                   = true;
     tbInfoLekar.Visible                   = false;
     btnLogOut.Visible                     = false;
     dgvCekaonica.Columns[5].Visible       = false;
     dgvHospitalizovani.Columns[5].Visible = false;
     cbBolnice.Enabled                     = true;
     btnIzabraniLekar.Enabled              = false;
 }
예제 #17
0
 private bool terminProvera(Lekar lekar)
 {
     foreach (Termin termini in Util.Instance.Termini)
     {
         if (termini.LekarID == lekar.ID && termini.Datum > DateTime.Now)
         {
             MessageBox.Show("Ne mozete obrisati lekara koji ima zakazan termin", "GRESKA");
             return(true);
         }
     }
     return(false);
 }
예제 #18
0
 private bool terapijaProvera(Lekar lekar)
 {
     foreach (Terapija terapije in Util.Instance.Terapije)
     {
         if (terapije.LekarID == lekar.ID && terapije.Aktivan == true)
         {
             MessageBox.Show("Ne mozete obrisati lekara koji ima poseduje terapije na svoje ime", "GRESKA");
             return(true);
         }
     }
     return(false);
 }
예제 #19
0
 // POST api/Lekar
 public bool Post([FromBody] Lekar obj)
 {
     try
     {
         ServiceProvider.Get <LekarService>().Create(obj);
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
 }
        public PrikazTerminaZaDz(int id, Lekar lekar, DateTime datum)
        {
            InitializeComponent();
            this.id    = id;
            this.lekar = lekar;
            this.datum = datum;

            ObservableCollection <Termin> pac2 = readTermin(id, lekar, datum);

            view = CollectionViewSource.GetDefaultView(pac2);
            dgDomZdravlja.ItemsSource = view;
            dgDomZdravlja.ColumnWidth = new DataGridLength(1, DataGridLengthUnitType.Star);
        }
예제 #21
0
            private void ucitajPacijente()
            {
                StreamReader file            = new StreamReader("Pacijenti.txt");
                int          brojPacijenata  = int.Parse(file.ReadLine().Trim());
                Random       randomGenerator = new Random();

                for (int i = 0; i < brojPacijenata; i++)
                {
                    Pacijent pacijent = new Pacijent(file.ReadLine().Trim(), file.ReadLine().Trim(), int.Parse(file.ReadLine().Trim()));
                    Lekar    lekar    = lekari[randomGenerator.Next(lekari.Length)];
                    lekar.prihvati(pacijent);
                }
                file.Close();
            }
예제 #22
0
            private double prosekGodinaPacijenata(Lekar lekar)
            {
                double suma = 0;

                for (int i = 0; i < lekar.BrojPacijenata; i++)
                {
                    suma += lekar.Pacijenti[i].Godine;
                }
                if (suma == 0)
                {
                    return(0);
                }
                return(lekar.BrojPacijenata);
            }
예제 #23
0
        public ActionResult DeleteConfirmed(int id)
        {
            //Lekar lekar = db.Lekari.Find(id);
            Lekar lekar = db.Lekari.Include(p => p.Files).SingleOrDefault(p => p.ID == id);
            File  file  = db.Files.Include(f => f.Lekar).SingleOrDefault(f => f.LekarID == id);

            db.Lekari.Remove(lekar);
            if (file != null)
            {
                db.Files.Remove(file);
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #24
0
        // GET: Lekar/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lekar lekar = db.Lekari.Find(id);

            if (lekar == null)
            {
                return(HttpNotFound());
            }
            return(View(lekar));
        }
예제 #25
0
        public LekarZTerapija(Terapija terapija, Lekar lekar)
        {
            InitializeComponent();
            this.lekar    = lekar;
            this.terapija = terapija;

            Random random = new Random();

            //      korisnik.ID = random.Next(1, 1000);
            terapija.Aktivan    = true;
            tbOpis.DataContext  = terapija;
            terapija.PacijentID = 836;
            terapija.LekarID    = lekar.ID;
        }
예제 #26
0
        private void ChangeDataGridView()
        {
            List <VrstaPregleda> pregledi  = Communication.Communication.Instance.PrikaziPreglede();
            List <Pacijent>      pacijenti = Communication.Communication.Instance.PrikaziPacijente();

            Lekar lekar = (Lekar)cbLekari.SelectedItem;

            Lekar     = lekar.Ime;
            pregledi  = pregledi.Where(p => p.Lekar.LekarID == lekar.LekarID).ToList();
            pacijenti = pacijenti.Where(p => p.Bolnica.SifraBolnice == lekar.Bolnica.SifraBolnice).ToList();

            dgvTermini.DataSource = listaTermina;
            AddComboBoxPacijenti(dgvTermini, pacijenti);
            AddComboBoxPregledi(dgvTermini, pregledi);
        }
예제 #27
0
        // GET: Lekar/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Lekar lekar = db.Lekari.Find(id);
            Lekar lekar = db.Lekari.Include(l => l.Files).SingleOrDefault(l => l.ID == id);//

            if (lekar == null)
            {
                return(HttpNotFound());
            }
            return(View(lekar));
        }
예제 #28
0
        public LekarGlavna(string jmbg)
        {
            InitializeComponent();
            pac2  = nadjiLekara(jmbg);
            lekar = nadjiLekara2(jmbg);

            view = CollectionViewSource.GetDefaultView(pac2);

            dgLekar.ItemsSource = view;
            dgLekar.IsSynchronizedWithCurrentItem = true;

            dgLekar.ColumnWidth = new DataGridLength(1, DataGridLengthUnitType.Star);

            viewT();
        }
예제 #29
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox2.SelectedIndex == -1 || comboBox3.SelectedIndex == -1 ||
         textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
     {
         MessageBox.Show("Popunite adekvatno sva polja!");
         return;
     }
     //MessageBox.Show(zdr[comboBox2.SelectedIndex].ZuID);
     if (azuriraj)
     {
         if (!lekar)
         {
             DataProvider.UpdateLekar(textBox3.Text, textBox1.Text, textBox2.Text, textBox4.Text, textBox5.Text, zdr[comboBox2.SelectedIndex].ZuID, odlj[comboBox3.SelectedIndex].IDodeljenja);
             MessageBox.Show("Lekar je uspesno azuriran!");
         }
         else
         {
             DataProvider.UpdateOsoblje(textBox3.Text, textBox1.Text, textBox2.Text, odlj[comboBox3.SelectedIndex].IDodeljenja, zdr[comboBox2.SelectedIndex].ZuID);
             MessageBox.Show("Osoblje je uspesno azurirano!");
         }
     }
     else
     {
         if (!lekar)
         {
             Lekar p = DataProvider.GetLekar(textBox3.Text);
             if (DataProvider.GetLekar(textBox3.Text).ime != null)
             {
                 MessageBox.Show("Vec postoji lekar sa tim JMBG-om!");
                 return;
             }
             DataProvider.AddLekar(textBox3.Text, zdr[comboBox2.SelectedIndex].ZuID, odlj[comboBox3.SelectedIndex].IDodeljenja, textBox1.Text, textBox2.Text, textBox4.Text, textBox5.Text);
             MessageBox.Show("Lekar je uspesno dodat!");
         }
         else
         {
             if (DataProvider.GetOsoba(zdr[comboBox2.SelectedIndex].ZuID, textBox3.Text).ime != null)
             {
                 MessageBox.Show("Vec postoji osoba sa tim JMBG-om!");
                 return;
             }
             DataProvider.AddOsoblje(zdr[comboBox2.SelectedIndex].ZuID, textBox3.Text, odlj[comboBox3.SelectedIndex].IDodeljenja, textBox1.Text, textBox2.Text, textBox4.Text);
             MessageBox.Show("Osoblje je uspesno dodato!");
         }
     }
     Close();
 }
예제 #30
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Da li ste sigurni?", "Potvrda",
                                MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                Lekar selektovaniKorisnik = view.CurrentItem as Lekar;

                if (terminProvera(selektovaniKorisnik) == false)
                {
                    if (terapijaProvera(selektovaniKorisnik) == false)
                    {
                        Util.Instance.DeleteDoktor(selektovaniKorisnik.JMBG);
                        view.Refresh();
                    }
                }
            }
        }