Example #1
0
        public ActionResult agregarDoctor(string nombre, string apellido, string cedula, DateTime fechaNacimiento, string sexo, string direccion, string telefono, int[] especialidades)
        {
            Entities model  = new Entities();
            DOCTOR   doctor = new DOCTOR();

            doctor.NOMBRE           = nombre;
            doctor.APELLIDO         = apellido;
            doctor.CEDULA           = cedula;
            doctor.FECHA_NACIMIENTO = fechaNacimiento;
            doctor.SEXO             = sexo;
            doctor.DIRECCION        = direccion;
            doctor.TELEFONO         = telefono;
            doctor.VISIBLE          = true;
            model.DOCTOR.Add(doctor);
            model.SaveChanges();
            foreach (int id in especialidades)
            {
                DOCTOR_ESPECIALIDAD de = new DOCTOR_ESPECIALIDAD();
                de.ID_DOCTOR       = doctor.ID;
                de.ID_ESPECIALIDAD = id;
                de.VISIBLE         = true;
                model.DOCTOR_ESPECIALIDAD.Add(de);
            }
            model.SaveChanges();
            return(Json(doctor));
        }
Example #2
0
        public DOCTOR getDoctorsByID(int id)
        {
            var    temp   = basedao.getDoctor(id, null, null, null, null, null, null, null);
            DOCTOR result = null;

            try
            {
                result = temp.First();
            }
            catch (System.InvalidOperationException e)
            {
                Console.WriteLine(e);
                return(null);
            }
            catch (System.ArgumentNullException e)
            {
                Console.WriteLine(e);
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
            return(result);
        }
Example #3
0
        public ActionResult nuevoDoctor(DOCTOR obj)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.distrito     = new SelectList(ListDistrito(), "IDE_DIS", "NOM_DIS");
                ViewBag.especialidad = new SelectList(ListEspecialidad(), "IDE_ESP", "DES_ESP");
                return(View(obj));
            }

            HttpClient clienteHttp = new HttpClient();

            clienteHttp.BaseAddress = new Uri("http://localhost/ApiCL3/");

            var request = clienteHttp.PostAsync("api/Doctor", obj, new JsonMediaTypeFormatter()).Result;

            if (request.IsSuccessStatusCode)
            {
                var resultString = request.Content.ReadAsStringAsync().Result;
                var estado       = JsonConvert.DeserializeObject <int>(resultString);
                if (estado == 1)
                {
                    ViewBag.distrito     = new SelectList(ListDistrito(), "IDE_DIS", "NOM_DIS");
                    ViewBag.especialidad = new SelectList(ListEspecialidad(), "IDE_ESP", "DES_ESP");
                    ViewBag.mensaje      = estado + " Empleado registrado correctamente..!!";
                    return(View(obj));
                }
                return(View(obj));
            }
            return(View());
        }
 public ActionResult Edit(DOCTOR DOCTOR)
 {
     if (ModelState.IsValid)
     {
         /*
          * db.Entry(DOCTOR).State = EntityState.Modified;
          * db.SaveChanges();
          * return RedirectToAction("index");
          */
         var userid    = Global.CurrentUserID;
         var DOCTOR_ID = userid;
         if (DOCTOR_ID < 0)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         //var DOCTOR_ID = "123";//change
         var p = db.DOCTOR.Find(DOCTOR_ID);
         p.DOCTOR_NM    = DOCTOR.DOCTOR_NM;
         p.GENDER       = DOCTOR.GENDER;
         p.AGE          = DOCTOR.AGE;
         p.TEL          = DOCTOR.TEL;
         p.SECTION_ID   = DOCTOR.SECTION_ID;
         p.DISEASE_ID   = DOCTOR.DISEASE_ID;
         p.INTRODUCTION = DOCTOR.INTRODUCTION;
         p.PHOTO_URL    = DOCTOR.PHOTO_URL;
         db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
        void AddDocTor()
        {
            try
            {
                if (idfield.Text.Length == 0 || specialityfield.Text.Length == 0 || namefield.Text.Length == 0)
                {
                    throw new Exception("Eror");
                }

                if (int.TryParse(idfield.Text, out int number))
                {
                    DOCTOR dOCTOR = new DOCTOR()
                    {
                        Id         = number,
                        Name       = namefield.Text,
                        Speciality = specialityfield.Text
                    };
                    AddDoctor(dOCTOR);
                    AllUpdate();
                }
                else
                {
                    throw new Exception("Eror parse!");
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message, "Text length = 0!");
            }
        }
Example #6
0
        public ActionResult Create(
            [Bind(Include = "DOCTOR_ID,DOCTOR_NM,GENDER,AGE,TEL,PHOTO_URL,SECTION_ID,DISEASE_ID,INTRODUCTION,INSDATE,PATIENT_ID,PATIENT_NM")]
            V_DOCTORINFO info)
        {
            var doctor = new DOCTOR()
            {
                DOCTOR_ID    = info.DOCTOR_ID,
                DOCTOR_NM    = info.DOCTOR_NM,
                GENDER       = info.GENDER,
                AGE          = info.AGE,
                DISEASE_ID   = info.DISEASE_ID,
                INTRODUCTION = info.INTRODUCTION,
                SECTION_ID   = info.SECTION_ID,
                TEL          = info.TEL,
                INSDATE      = DateTime.Now,
            };

            if (ModelState.IsValid)
            {
                db.DOCTOR.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(info));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DOCTOR dOCTOR = db.DOCTORS.Find(id);

            db.DOCTORS.Remove(dOCTOR);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #8
0
 public ActionResult Edit([Bind(Include = "dpi,nombre,direccion,telefono,puesto,sueldo")] DOCTOR dOCTOR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dOCTOR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dOCTOR));
 }
 public ActionResult DoctorRegistration(DOCTOR Doc)
 {
     if (ModelState.IsValid)
     {
         db.DOCTORS.Add(Doc);
         db.SaveChanges();
         return(RedirectToAction(""));
     }
     return(View());
 }
Example #10
0
 public ActionResult Edit([Bind(Include = "DOCTOID,NAME,SURNAME,DOB,ADDRESS,STREET,POSTCODE,MOBILE")] DOCTOR doctor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctor));
 }
 public ActionResult Edit([Bind(Include = "DOCTORID,DOCTORNAME,DOCTORADDRESS,DOCTOREmail,DOCTORTelePhone,DOCTORWorkingHours,ClinicID,CLINICGoogleUID,ClinicName,USERID,USERNAME,USERSearchDATETIME")] DOCTOR dOCTOR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dOCTOR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClinicID = new SelectList(db.CLINICS, "ClinicID", "CLINICGoogleUID", dOCTOR.ClinicID);
     return(View(dOCTOR));
 }
Example #12
0
        public ActionResult Create([Bind(Include = "DOCTOID,NAME,SURNAME,DOB,ADDRESS,STREET,POSTCODE,MOBILE")] DOCTOR dOCTOR)
        {
            if (ModelState.IsValid)
            {
                db.DOCTORS.Add(dOCTOR);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dOCTOR));
        }
Example #13
0
 public IHttpActionResult Add()
 {
     using (HIST_CLINEntities bd = new HIST_CLINEntities())
     {
         var objDOCTOR = new DOCTOR();
         objDOCTOR.nombre_doctor   = "Stephen";
         objDOCTOR.apellido_doctor = "Paucara";
         bd.DOCTOR.Add(objDOCTOR);
         bd.SaveChanges();
     }
     return(Ok("Nuevo registro exitoso"));
 }
Example #14
0
        public ActionResult Create([Bind(Include = "dpi,nombre,direccion,telefono,puesto,sueldo")] DOCTOR dOCTOR)
        {
            if (ModelState.IsValid)
            {
                db.DOCTOR.Add(dOCTOR);
                db.SaveChanges();
                long?enviar = dOCTOR.dpi;
                return(RedirectToAction("Create", "ESPECIALIDAD_DOCTOR", new { dpi = enviar }));
            }

            return(View(dOCTOR));
        }
 public ActionResult DoctorEditInfo(DOCTOR Doc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Doc).State = EntityState.Modified;;
         db.SaveChanges();
         return(Redirect("/Account/DoctorDashboard"));
     }
     else
     {
         return(HttpNotFound());
     }
 }
 public ActionResult DoctorRegisteration(DOCTOR Doc)
 {
     if (ModelState.IsValid)
     {
         db.DOCTORS.Add(Doc);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(HttpNotFound());
     }
 }
Example #17
0
        public int Put(DOCTOR objD)
        {
            var unDoctor = db.DOCTOR.Where(p => p.IDE_DOC == objD.IDE_DOC).FirstOrDefault();

            unDoctor.IDE_DOC = objD.IDE_DOC;
            unDoctor.NOM_DOC = objD.NOM_DOC;
            unDoctor.APE_DOC = objD.APE_DOC;
            unDoctor.IDE_ESP = objD.IDE_ESP;
            unDoctor.TEL_DOC = objD.TEL_DOC;
            unDoctor.COR_DOC = objD.COR_DOC;
            unDoctor.IDE_DIS = objD.IDE_DIS;

            return(db.SaveChanges());
        }
Example #18
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DOCTOR doctor = db.DOCTORS.Find(id);

            if (doctor == null)
            {
                return(HttpNotFound());
            }
            return(View(doctor));
        }
        // GET: DOCTORs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DOCTOR dOCTOR = db.DOCTORS.Find(id);

            if (dOCTOR == null)
            {
                return(HttpNotFound());
            }
            return(View(dOCTOR));
        }
        public List <string> DoctorLogin(string prefix, string profix)
        {
            string        UserName = prefix.Trim();
            string        Password = profix.Trim();
            List <string> Doc      = new List <string>();

            try
            {
                DOCTOR d = db.DOCTORS.Where(a => a.UserName == UserName && a.Password == Password).FirstOrDefault();
                Doc.Add(d.Id.ToString());
                Doc.Add(d.FullName);
            }
            catch { Doc.Add("error"); }
            return(Doc);
        }
        // GET: DOCTORs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DOCTOR dOCTOR = db.DOCTORS.Find(id);

            if (dOCTOR == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClinicID = new SelectList(db.CLINICS, "ClinicID", "CLINICGoogleUID", dOCTOR.ClinicID);
            return(View(dOCTOR));
        }
Example #22
0
        public void LoadDoctors()
        {
            SqlConnection connection = new SqlConnection(MyProject.Properties.Settings.Default.Connection);
            try
            {
                connection.Open();
            }
            catch (Exception ex)
            {
                connection = new SqlConnection(MyProject.Properties.Settings.Default.Connection);
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                using (FileStream fstream = File.OpenRead("SQLQuery2.sql"))
                {
                    // преобразуем строку в байты
                    byte[] array = new byte[fstream.Length];
                    // считываем данные
                    fstream.Read(array, 0, array.Length);
                    // декодируем байты в строку
                    string textFromFile = Encoding.Default.GetString(array);
                    command.CommandText = textFromFile;
                    command.ExecuteNonQuery();
                }
            }
            finally
            {

                string selectdoc = $"select * from DOCTOR ";
                SqlCommand commanddoc = new SqlCommand(selectdoc, connection);
                using (SqlDataReader reader = commanddoc.ExecuteReader())
                {

                    while (reader.Read())
                    {
                        Admin doctors = new Admin(reader.GetInt32(0));

                        doctors.IDdoctor = reader.GetInt32(0);
                        doctors.Doctor = reader.GetString(2);
                        doctors.Specialization = reader.GetString(3);
                        doctors.Experience =Convert.ToString(reader.GetValue(4));
                        doctors.Room = reader.GetInt32(5);
                        DOCTOR.Add(doctors);
                    }

                }
                connection.Close();
            }
        }
 public ActionResult DoctorLogin(DOCTOR Doc)
 {
     if (ModelState.IsValid)
     {
         var details = (from DoctorList in db.DOCTORS
                        where DoctorList.UserName == Doc.UserName && DoctorList.Password == Doc.Password
                        select new { DoctorList.Id, DoctorList.FirstName, DoctorList.LastName }).ToList();
         if (details.FirstOrDefault() != null)
         {
             Session["DoctorId"]   = details.FirstOrDefault().Id;
             Session["DoctorName"] = details.FirstOrDefault().FirstName + " " + details.FirstOrDefault().LastName;
             return(RedirectToAction("DoctorDashboard", "Account"));
         }
     }
     else
     {
         ModelState.AddModelError("", "Error");
     }
     return(View(Doc));
 }
Example #24
0
        public DOCTOR DoctorLogin(string email, string password, string random)
        {
            int    ID     = dao.getDoctorIdByEmail(email);
            DOCTOR result = dao.getDoctorsByID(ID);

            if (result != null)
            {
                if (code((result).PASSWORD + random).Equals(password.ToLower()))
                {
                    return(result);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
 private void btnTambahDok_Click(object sender, RoutedEventArgs e)
 {
     if (cmbPoli.Text == "Khusus")
     {
         DOCTOR dokterkhusus = new DOCTOR()
         {
             NAME          = txtNamaDok.Text,
             EMAIL         = txtEmailDok.Text,
             ADDRESS       = txtAlamatDok.Text,
             PHONE         = txtNoTelpDok.Text,
             GENDER        = getJenisKelaminDokter(),
             SPECIALIST_ID = Convert.ToInt32(cmbSpecialis.SelectedValue),
             POLY_ID       = Convert.ToInt32(cmbPoli.SelectedValue)
         };
         et.DOCTORs.Add(dokterkhusus);
         et.SaveChanges();
         clearTextDokter();
         dgDokter.UnselectAllCells();
         this.ViewDokterSpecialis(dgDokter);
         MessageBox.Show("Tambah Data Dokter Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (cmbPoli.Text == "Umum")
     {
         DOCTOR dokterumum = new DOCTOR()
         {
             NAME    = txtNamaDok.Text,
             EMAIL   = txtEmailDok.Text,
             ADDRESS = txtAlamatDok.Text,
             PHONE   = txtNoTelpDok.Text,
             GENDER  = getJenisKelaminDokter(),
             POLY_ID = Convert.ToInt32(cmbPoli.SelectedValue)
         };
         et.DOCTORs.Add(dokterumum);
         et.SaveChanges();
         clearTextDokter();
         dgDokter.UnselectAllCells();
         this.ViewDokterNonSpecialis(dgDokter);
         MessageBox.Show("Tambah Data Dokter Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
        public JsonResult DoctorAjaxRegistration(string FirstName, string LastName, string FatherName, int Specialization, int Specialty1, int?Specialty2, int?Specialty3, string Country, int City, string Address, string Phone, string Mobile, string Password)
        {
            if (Specialty2 == 0)
            {
                Specialty2 = null;
            }
            if (Specialty3 == 0)
            {
                Specialty3 = null;
            }
            int    id       = db.DOCTORS.Max(a => a.Id) + 1;
            string username = FirstName + "_" + id;
            DOCTOR doc      = new DOCTOR()
            {
                FirstName      = FirstName,
                LastName       = LastName,
                FatherName     = FatherName,
                FullName       = FirstName + " " + FatherName + " " + LastName,
                specialization = Specialization,
                Specialty1     = Specialty1,
                Specialty2     = Specialty2,
                Specialty3     = Specialty3,
                Country        = Country,
                City           = City,
                Address        = Address,
                Phone          = Phone,
                Mobile         = Mobile,
                UserName       = username,
                Password       = Password
            };

            try
            {
                db.DOCTORS.Add(doc);
                db.SaveChanges();

                return(Json(username, JsonRequestBehavior.AllowGet));
            }
            catch { return(Json(0, JsonRequestBehavior.AllowGet)); }
        }
        private void btnEditDok_Click(object sender, RoutedEventArgs e)
        {
            object item    = dgDokter.SelectedItem;
            string temp_id = (dgDokter.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
            int    id      = Convert.ToInt32(temp_id);

            DOCTOR dokter = SearchByIdDokter(id);

            if (cmbPoli.Text == "Khusus")
            {
                dokter.NAME            = txtNamaDok.Text;
                dokter.EMAIL           = txtEmailDok.Text;
                dokter.ADDRESS         = txtAlamatDok.Text;
                dokter.PHONE           = txtNoTelpDok.Text;
                dokter.SPECIALIST_ID   = Convert.ToInt32(cmbSpecialis.SelectedValue);
                dokter.POLY_ID         = Convert.ToInt32(cmbPoli.SelectedValue);
                dokter.GENDER          = getJenisKelaminDokter();
                et.Entry(dokter).State = System.Data.Entity.EntityState.Modified;
                et.SaveChanges();
                clearTextDokter();
                this.ViewDokterSpecialis(dgDokter);
                MessageBox.Show("Update Data Dokter Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else if (cmbPoli.Text == "Umum")
            {
                dokter.NAME            = txtNamaDok.Text;
                dokter.EMAIL           = txtEmailDok.Text;
                dokter.ADDRESS         = txtAlamatDok.Text;
                dokter.PHONE           = txtNoTelpDok.Text;
                dokter.POLY_ID         = Convert.ToInt32(cmbPoli.SelectedValue);
                dokter.GENDER          = getJenisKelaminDokter();
                et.Entry(dokter).State = System.Data.Entity.EntityState.Modified;
                et.SaveChanges();
                clearTextDokter();
                this.ViewDokterNonSpecialis(dgDokter);
                MessageBox.Show("Update Data Dokter Berhasil !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Example #28
0
 private void deleteClick2(object sender, RoutedEventArgs e)
 {
     try {
         if (doctorGrid.SelectedItems.Count > 0)
         {
             for (int i = 0; i < doctorGrid.SelectedItems.Count; i++)
             {
                 DOCTOR doctor = doctorGrid.SelectedItems[i] as DOCTOR;
                 if (doctor != null)
                 {
                     db.DOCTOR.Remove(doctor);
                 }
             }
         }
         db.SaveChanges();
         doctorGrid.ItemsSource = db.DOCTOR.Local.ToBindingList();
     }
     catch (Exception)
     {
         MessageBox.Show("Выберите строку и повторите.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         doctorGrid.ItemsSource = db.DOCTOR.Local.ToBindingList();
     }
 }
        public void AddDoctor(DOCTOR doctor)
        {
            DatMan   DatMan   = new DatMan();
            Hospital hospital = new Hospital(); hospital = DatMan.ReadToObject <Hospital>();
            bool     e        = false;

            foreach (var el in hospital.ds)
            {
                if (el.Id.ToString() == idfield.Text)
                {
                    e = true;
                }
            }
            if (e == false)
            {
                hospital.ds.Add(doctor);
                DatMan.Write(hospital);
            }
            else
            {
                ShowMesText(messege1, "Врач с таким Id уже существует!!!");
            }
        }
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            DOCTOR dOCTOR = new DOCTOR()
            {
                Id = 10, Name = "Maxs", Speciality = "Oftalmolog"
            };
            Patient patient = new Patient()
            {
                age = 10, Id = 121, Name = "Andrey"
            };
            Visit visit = new Visit()
            {
                Id = 1, DoctorId = dOCTOR.Id, PatientId = patient.Id, time = DateTime.Now, Diagnostik = "eye", Reason = "terible"
            };

            Console.WriteLine(dOCTOR);
            Console.WriteLine(patient);
            Console.WriteLine(visit);
            Hospital hospital = new Hospital();

            hospital.ds.Add(dOCTOR);
            hospital.patients.Add(patient);
            hospital.visits.Add(visit);
            hospital.ds.Add(dOCTOR);
            hospital.patients.Add(patient);
            hospital.visits.Add(visit);
            hospital.ds.Add(dOCTOR);
            hospital.patients.Add(patient);
            hospital.visits.Add(visit);

            //DatMan datMan = new DatMan();
            //datMan.Write(hospital);

            //datMan.ReadToObject();
        }