Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,DocName,Email,Address,State,Country")] DoctorList doctorList)
        {
            if (id != doctorList.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(doctorList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorListExists(doctorList.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctorList));
        }
Example #2
0
        public HttpResponseMessage GetAllDoctors(Doctors doctor)
        {
            try
            {
                List <Doctors> doctors = new List <Doctors>();
                string         query   = "select fname,lname,address,specilization,picture,doc.status from [dbo].[Doctor] doc inner join [dbo].[DoctorClinicAssociation] dasoc on doc.Id=dasoc.doctorId where doc.status=1 and dasoc.clinicId='" + doctor.ClinicId + "'";
                DataTable      dt      = DBOperations.GetDataFromQueryString(ConfigurationManager.AppSettings["dbString"].ToString(), query);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Doctors _doctor = new Doctors()
                    {
                        Fname         = dt.Rows[i]["fname"].ToString(),
                        Lname         = dt.Rows[i]["lname"].ToString(),
                        Address       = dt.Rows[i]["address"].ToString(),
                        Specilization = dt.Rows[i]["specilization"].ToString(),
                        Picture       = dt.Rows[i]["picture"].ToString(),
                        Status        = dt.Rows[i]["status"].ToString()
                    };
                    doctors.Add(_doctor);
                }

                DoctorList response = new DoctorList()
                {
                    list = doctors
                };
                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #3
0
        public HttpResponseMessage ClinicDoctors(Clinic clinic)
        {
            try
            {
                List <Doctors> allDoctors = new List <Doctors>();
                DataTable      dt         = DBOperations.GetDataFromQueryString(ConfigurationManager.AppSettings["dbString"].ToString(), "select Id,fName,lname from Doctor where Clinic_Id='" + clinic.ClinicId + "'");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Doctors doctor = new Doctors()
                    {
                        ClinicId = dt.Rows[i]["Id"].ToString(),
                        Fname    = dt.Rows[i]["fname"].ToString() + " " + dt.Rows[i]["lname"].ToString()
                    };
                    allDoctors.Add(doctor);
                }

                DoctorList _list = new DoctorList()
                {
                    list = allDoctors
                };
                return(Request.CreateResponse(HttpStatusCode.OK, _list));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #4
0
        public ActionResult List()
        {
            var form = new DoctorList {
                Doctors = Get <IDoctorRepository>().GetAll()
            };

            return(View(form));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("ID,DocName,Email,Address,State,Country")] DoctorList doctorList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctorList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctorList));
        }
 public ActionResult Create(DoctorList list)
 {
     try
     {
         long count = 0;
         if (db.DoctorLists.Any())
         {
             count = db.DoctorLists.Max(m => m.DoctorID);
             count++;
         }
         else
         {
             count = 1000;
         }
         var    file = Request.Files["file"];
         string name = "";
         if (file.ContentLength > 0)
         {
             string extension = System.IO.Path.GetExtension(file.FileName);
             name = Convert.ToString(count) + extension;
             string pic  = System.IO.Path.GetFileName(file.FileName);
             string path = System.IO.Path.Combine(Server.MapPath("~/Uploads/MyDoctors"), name);
             file.SaveAs(path);
             list.Images = name;
         }
         string role = Convert.ToString(Session["RoleName"]);
         if (role == "Admin")
         {
             if (list.DoctorName == "" || list.DoctorName == null || ModelState.IsValid == false)
             {
                 int helper = Convert.ToInt32(list.HelperID);
                 ViewBag.HelperID = new SelectList(db.Registrations.Where(m => m.Role != "Admin"), "UserID", "UserName", list.HelperID);
                 ViewBag.UserID   = new SelectList(db.UserRegistrations.Where(m => m.HelperID == helper), "UserID", "UserName");
                 return(View());
             }
         }
         if (ModelState.IsValid)
         {
             if (list.HelperID <= 0 || list.HelperID == null)
             {
                 list.HelperID = Convert.ToInt32(Session["UserID"]);
             }
             db.DoctorLists.Add(list);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(list));
     }
     catch
     {
         return(View(list));
     }
 }
Example #7
0
        protected void ddlClinic2_SelectedIndexChanged(object sender, EventArgs e)
        {
            DoctorList doctors = GetDoctors(ddlClinic2.SelectedValue.ToString());

            if (doctors != null)
            {
                ddlDoctors2.DataSource     = doctors.list;
                ddlDoctors2.DataTextField  = "Fname";
                ddlDoctors2.DataValueField = "DoctorId";
                ddlDoctors2.DataBind();
            }
        }
 // GET: DoctorList/Delete - Delete the particular record
 public ActionResult Delete(int id)
 {
     try
     {
         DoctorList lst = db.DoctorLists.Find(id);
         db.DoctorLists.Remove(lst);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
 public ActionResult Edit(DoctorList list)
 {
     try
     {
         int    user = Convert.ToInt32(Session["listuser"]);
         string role = Convert.ToString(Session["RoleName"]);
         var    file = Request.Files["file"];
         string name = "";
         if (file.ContentLength > 0)
         {
             string extension = System.IO.Path.GetExtension(file.FileName);
             name = Convert.ToString(list.DoctorID) + extension;
             string pic  = System.IO.Path.GetFileName(file.FileName);
             string path = System.IO.Path.Combine(Server.MapPath("~/Uploads/MyDoctors"), name);
             file.SaveAs(path);
             list.Images = name;
         }
         else
         {
             list.Images = Convert.ToString(list.Images);
         }
         if (role == "Admin")
         {
             if (user != list.HelperID)
             {
                 int helper = Convert.ToInt32(list.HelperID);
                 ViewBag.HelperID    = new SelectList(db.Registrations.Where(m => m.Role != "Admin"), "UserID", "UserName", list.HelperID);
                 ViewBag.UserID      = new SelectList(db.UserRegistrations.Where(m => m.HelperID == helper), "UserID", "UserName");
                 Session["listuser"] = list.HelperID;
                 return(View(list));
             }
         }
         if (ModelState.IsValid)
         {
             db.Entry(list).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(list));
     }
     catch
     {
         return(View(list));
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //

            //

            if (!IsPostBack)
            {
                ListItem emptyItem = new ListItem("----Select----", "");
                DoctorList.DataSource = _doctorRepository.GetDoctors();
                DoctorList.DataBind();
                DoctorList.DataTextField  = "DoctorName";
                DoctorList.DataValueField = "DoctorName";
                DoctorList.DataBind();
                DoctorList.Items.Insert(0, emptyItem);

                HospitalList.DataSource = _hospitalRepository.GetHospitals();
                HospitalList.DataBind();
                HospitalList.DataTextField  = "HospitalName";
                HospitalList.DataValueField = "HospitalName";
                HospitalList.DataBind();
                HospitalList.Items.Insert(0, emptyItem);

                SpecialityList.DataSource = _specialityRepository.GetSpecialities();
                SpecialityList.DataBind();
                SpecialityList.DataTextField  = "Speciality";
                SpecialityList.DataValueField = "Speciality";
                SpecialityList.DataBind();
                SpecialityList.Items.Insert(0, emptyItem);

                IDictionary <string, bool?> isActive = new Dictionary <string, bool?>();
                isActive.Add("----Select----", null);
                isActive.Add("Active", true);
                isActive.Add("Not Active", false);

                IsActiveList.DataSource = isActive.ToList();
                IsActiveList.DataBind();
                IsActiveList.DataTextField  = "key";
                IsActiveList.DataValueField = "value";
                IsActiveList.DataBind();

                GenerateReport();
            }
        }
Example #11
0
 public void DoSearch(Action onComplete)
 {
     IsLoading = true;
     WebService.SearchDoctors(new SearchDoctorRequest()
     {
         Title      = SearchText,
         PositionId = SelectedSpeicalties != null ? SelectedSpeicalties.ID : 0
     }, result =>
     {
         if (result.Success)
         {
             DoctorList.Clear();
             DoctorList = result.Result;
             RaisePropertyChanged("DoctorList");
         }
         else
         {
             ShowError(result.ErrorMessage);
         }
         IsLoading = false;
         onComplete();
     });
 }
Example #12
0
 public NewAppointmentVM()
 {
     initializeLists();
     _doctorList     = new DoctorList();
     _newAppointment = new Appointment();
 }
Example #13
0
        private void DoctorsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DoctorList form = new DoctorList(service.GetDdvDoctorService());

            form.ShowDialog();
        }
Example #14
0
        public void TestInitialize()
        {
            // Create Doctors
            doctorList = new DoctorList
            {
                Doctors = new List <Doctor>
                {
                    new Doctor {
                        Name = "John", Roles = new List <string> {
                            "Oncologist"
                        }
                    },
                    new Doctor {
                        Name = "Anna", Roles = new List <string> {
                            "GeneralPractition"
                        }
                    },
                    new Doctor {
                        Name = "Laura", Roles = new List <string> {
                            "GeneralPractitioner", "Oncologist"
                        }
                    }
                }
            };

            // Create Treatment Machines
            treatmentMachineList = new TreatmentMachineList
            {
                TreatmentMachines = new List <TreatmentMachine>
                {
                    new TreatmentMachine {
                        Capability = "Advanced", Name = "MachineA"
                    },
                    new TreatmentMachine {
                        Capability = "Advanced", Name = "MachineB"
                    },
                    new TreatmentMachine {
                        Capability = "Simple", Name = "MachineC"
                    },
                }
            };

            // Create Treatment Rooms
            treatmentRoomList = new TreatmentRoomList
            {
                TreatmentRooms = new List <TreatmentRoom>
                {
                    new TreatmentRoom {
                        Name = "RoomOne"
                    },
                    new TreatmentRoom {
                        Name = "RoomTwo"
                    },
                    new TreatmentRoom {
                        Name = "RoomThree", TreatmentMachine = "MachineA"
                    },
                    new TreatmentRoom {
                        Name = "RoomFour", TreatmentMachine = "MachineB"
                    },
                    new TreatmentRoom {
                        Name = "RoomFive", TreatmentMachine = "MachineC"
                    }
                }
            };

            // Create Patients
            // TODO:  Construct RegistrationDate based on offsets from current date to drive test scenario
            var today = DateTime.Now.ToString("yyyyMMdd");

            patientList = new PatientList
            {
                Patients = new List <Patient>
                {
                    new Patient
                    {
                        Name             = "Patient_1",
                        RegistrationDate = today,
                        Condition        = new Condition {
                            Diagnosis = "Flu", Topography = ""
                        }
                    },
                    new Patient
                    {
                        Name             = "Patient_2",
                        RegistrationDate = today,
                        Condition        = new Condition {
                            Diagnosis = "Cancer", Topography = "Breast"
                        }
                    }
                }
            };

            // Create Consultations
            consultationList = new ConsultationList
            {
                Consultations = new List <Consultation>
                {
                    new Consultation
                    {
                        Patient           = "Patient_1",
                        PatientCondition  = "Flu",
                        PatientTopography = "",
                        Doctor            = "Anna",
                        DoctorRole        = "Oncologist",
                        TreatmentRoom     = "RoomOne",
                        MachineName       = "",
                        MachineCapability = "",
                        ConsultationDate  = today
                    },
                    new Consultation
                    {
                        Patient           = "Patient_2",
                        PatientCondition  = "Cancer",
                        PatientTopography = "Breast",
                        Doctor            = "John",
                        DoctorRole        = "Oncologist",
                        TreatmentRoom     = "RoomFive",
                        MachineName       = "MachineC",
                        MachineCapability = "Simple",
                        ConsultationDate  = today
                    },
                }
            };
        }