public bool addDoctor(doctor d)
        {
            dc.doctors.InsertOnSubmit(d);
            dc.SubmitChanges();

            return(true);
        }
Example #2
0
        //doctor
        public bool EditDoctor(int id, string fn, string n, string fan, int pos, Decimal qual, bool notNull)
        {
            reloadDB();
            doctor d = db.doctors.Find(id);

            if (d != null)
            {
                d.family_name = fn;
                d.name        = n;
                d.father_name = fan;
                d.position    = pos;

                /*
                 * if (qual != null && qual != "")
                 *  d.qualification = Convert.ToInt32(qual);
                 * else
                 *  d.qualification = null;
                 */

                if (notNull)
                {
                    d.qualification = Convert.ToInt32(qual);
                }
                else
                {
                    d.qualification = null;
                }

                /*
                 * int q = Convert.ToInt32(qual);
                 * if (q != d.qualification)
                 * {
                 *  if (notNull)
                 *      d.qualification = q;
                 *  else
                 *      d.qualification = null;
                 * }
                 */
                /*
                 * string command = "UPDATE Doctor SET family_name = '" + fn + "', name = '" + n + "', father_name = '" + fan + "', position = " + pos;
                 * if (notNull)
                 * {
                 *  int q = Convert.ToInt32(qual);
                 *  command += ", qualification = " + q;
                 * }
                 * command += " WHERE id = " + id + ";";
                 */
                try
                {
                    db.SaveChanges();
                    //db.Database.ExecuteSqlCommand(command);
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            return(false);
        }
        public bool editDoctor(doctor d, bool admin)
        {
            doctor dr = (from x in dc.GetTable <doctor>()
                         where x.doctorid == d.doctorid
                         select x).SingleOrDefault();

            if (admin == true)
            {
                dr.name          = d.name;
                dr.dob           = d.dob;
                dr.experience    = d.experience;
                dr.salary        = d.salary;
                dr.field         = d.field;
                dr.qualification = d.qualification;
            }
            //set updated values :
            dr.email    = d.email;
            dr.phoneno  = d.phoneno;
            dr.address  = d.address;
            dr.password = d.password;


            dc.SubmitChanges();

            //If error , return false
            return(true);
        }
Example #4
0
 //login operation
 public JsonResult logIn(string userName, string password, bool checkBox)
 {
     try{
         bool   isPresistent = (checkBox == false) ? false : true;
         doctor doc          = getCurrentDoctorByUserName(userName);
         //the email will registered as name
         if (Membership.ValidateUser(userName, password) == true && doc != null)
         {//user is validated
             addAuthenticationCookie(userName, isPresistent);
             if (!db.doctorInfoes.Any(d => d.doctorID == doc.id))
             {//user not founded at database
                 return(Json(new { status = 0 }, JsonRequestBehavior.AllowGet));
             }
             //doctor is founded at database
             return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {//user not validated
             return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
     }
 }
Example #5
0
        //account page
        public ActionResult account()
        {
            //send all specialities to account page
            ViewBag.specialities = db.specialities.getSpecialityDataList().ToList();
            //send all cities to account page
            ViewBag.cities = db.cities.getCityDataList().ToList();
            //get the current doctor
            doctor oldDoctor = db.doctors.Single(doc => doc.username == User.Identity.Name);
            //get the account page data
            doctorAccountData currentDoctor = new doctorAccountData();

            currentDoctor.username    = oldDoctor.username;
            currentDoctor.bookingType = oldDoctor.bookingType;
            currentDoctor.cityID      = db.destricts.FirstOrDefault(d => d.id == oldDoctor.destrictID).cityID;
            currentDoctor.destrictID  = oldDoctor.destrictID;
            currentDoctor.mail        = oldDoctor.mail;
            currentDoctor.password    = oldDoctor.password;
            currentDoctor.phone       = oldDoctor.phone;
            currentDoctor.proImage    = oldDoctor.proImage;
            if (oldDoctor.specialities.First().superSpecialityID != null)
            {//doctor has sub specialities
                currentDoctor.spID    = (byte)oldDoctor.specialities.First().superSpecialityID;
                currentDoctor.subSpID = oldDoctor.specialities.Select(s => s.id.ToString()).ToList();
            }
            else
            {//doctor has main speciality and not subspeciality
                currentDoctor.spID    = oldDoctor.specialities.First().id;
                currentDoctor.subSpID = new List <string>();
            }
            return(View(currentDoctor));
        }
Example #6
0
 //change password page
 public ActionResult changePassword(string userID, string password)
 {
     //this function show form that withen user can change his password
     try
     {
         Guid requestID = Guid.Parse(userID);
         resetPasswordRequest request = db.resetPasswordRequests.FirstOrDefault(r => r.id == requestID);
         if (request != null)
         {
             doctor         doctor        = db.doctors.FirstOrDefault(d => d.id == request.userID);
             MembershipUser docMember     = Membership.GetUser(doctor.username);
             var            generatedPass = docMember.ResetPassword();
             docMember.ChangePassword(generatedPass, password);
             doctor.password         = password;
             db.Entry(doctor).State  = System.Data.Entity.EntityState.Modified;
             db.Entry(request).State = System.Data.Entity.EntityState.Deleted;
             Membership.UpdateUser(docMember);
             db.SaveChanges();
             return(View(model: Resource1.passwordChangedSuccessfully));
         }
         else
         {
             ViewBag.error = tabeeb.Areas.users.languages.Resource1.linkExpired;
             return(View(model: userID));
         }
     }
     catch (Exception)
     {
         ViewBag.error = tabeeb.Areas.users.languages.Resource1.problemOnDoingOperationAtServer;
         return(View(model: userID));
     }
 }
        public ActionResult DoctorDelete(int id, doctor doc)
        {
            var UserName = doc.user_name;

            try
            {
                // Deleting the photo of this doctor
                var    image    = doc.photo_path;
                string fullPath = Server.MapPath("~/Content/images/doctors/"
                                                 + image);

                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(Server.MapPath("~/Content/images/doctors/"
                                                         + image));
                }

                // Deleting Doctor from doctor table and remove all profile and acount ...
                objDoc.commitDelete(id);
                Roles.RemoveUserFromRole(UserName, "doctor");
                Membership.DeleteUser(UserName);
                return(RedirectToAction("ListDoctor"));
            }
            catch
            {
                return(View());
            }
        }
Example #8
0
    public static doctor check_spec_name(string doc_name)
    {
        string query = String.Format("select specialist.emp_doc_specialist from employee_doctor inner join specialist On specialist.emp_doc_specialistid = employee_doctor.emp_doc_specialistid where employee_doctor.emp_doc_name = '{0}'", doc_name);

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                string specname = reader.GetString(0);



                doctor doc = new doctor(specname);
                return(doc);
            }
        }
        finally
        {
            conn.Close();
        }

        return(null);
    }
        public ObservableCollection <DoctorPatients> GetPatientsDoctor(doctor doc)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            List <DoctorPatients> auxList = new List <DoctorPatients>();

            foreach (var patient in context.patients)
            {
                int counter = 0;
                if (patient.idDoc == doc.idDoctor)
                {
                    foreach (var appointment in context.appointments)
                    {
                        if (appointment.idPatient == patient.idPatient)
                        {
                            counter += 1;
                        }
                    }
                    auxList.Add(new DoctorPatients(doc, patient, counter));
                }
            }
            var a = auxList.OrderBy(si => si.NumberOfProcedures).ToList();
            ObservableCollection <DoctorPatients> auxList2 = new ObservableCollection <DoctorPatients>();

            auxList.Sort(new Comparison <DoctorPatients>((x, y) => x.NumberOfProcedures.CompareTo(y.NumberOfProcedures)));

            foreach (var patient in auxList)
            {
                auxList2.Add(patient);
            }
            return(auxList2);
        }
Example #10
0
        public void update(int id)
        {
            doctor p = ut.DoctorRepository.GetById(id);

            ut.DoctorRepository.Update(p);
            ut.commit();
        }
Example #11
0
        public void deleteDoctorById(int id)
        {
            doctor p = ut.DoctorRepository.GetById(id);

            ut.DoctorRepository.Delete(p);
            ut.commit();
        }
Example #12
0
        public void c_DeleteDoctorInDataBase()
        {
            Delete deleteClass = new Delete();
            doctor testObject  = new doctor(201067881, "Doctor", "Test", "male", 30000.0, "0");

            Assert.IsTrue(deleteClass.delete(testObject));
        }
Example #13
0
        public ActionResult Index(string currentFilter, string searchString, int?page)
        {
            var    authId     = User.Identity.GetUserId();
            doctor dataDoctor = db.doctors.FirstOrDefault(e => e.userId == authId);


            ViewBag.Doctor = doctorService.DoctorAuth(authId);
            /*call all data from service*/
            var data = doctorService.TodaySchedule(dataDoctor.userId);

            /*search data from name patient*/
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.CurrentFilter = searchString;
            int pageNumber = (page ?? 1);
            int pageSize   = 10;

            return(View(data.ToPagedList(pageNumber, pageSize)));
        }
Example #14
0
        public void remove(doctor d)
        {
            user user = hms.users.Where(x => x.uid == d.employee.user.uid).FirstOrDefault();

            hms.users.Remove(user);
            hms.SaveChanges();
        }
        public ActionResult Create(doctor doctor)
        {
            db.doctor.Add(doctor);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Example #16
0
        public async Task <IHttpActionResult> Putdoctor(int id, doctor doctor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != doctor.Doctor_Id)
            {
                return(BadRequest());
            }

            db.Entry(doctor).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!doctorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #17
0
        public ActionResult Index(string currentFilter, string searchString, int?page)
        {
            var    userID     = User.Identity.GetUserId();
            doctor dataDoctor = db.doctors.FirstOrDefault(e => e.userId == userID);

            /*call all data from service*/
            var data = patientService.allDoctorPatient(dataDoctor.userId);

            /*search data from name patient*/
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewBag.CurrentFilter = searchString;
            if (!String.IsNullOrEmpty(searchString))
            {
                data = patientService.searchPatientFromNameAndIdDoctor(searchString, dataDoctor.id);
            }

            int pageNumber = (page ?? 1);
            int pageSize   = 10;

            return(View(data.ToPagedList(pageNumber, pageSize)));
        }
        protected void login_btn_Click(object sender, EventArgs e)
        {
            if (email_tb.Text == "admin" && password_tb.Text == "admin")
            {
                Session["admin"] = 1;
                Response.Redirect("AdminHome.aspx");
            }
            DoctorClass            cm = new DoctorClass();
            DataClassesDataContext dc = new DataClassesDataContext();
            doctor p = new doctor();

            p.email    = email_tb.Text;
            p.password = password_tb.Text;
            bool b = cm.login(p);

            if (b)
            {
                var q = from doctor in dc.GetTable <doctor>() where doctor.email == email_tb.Text && doctor.password == password_tb.Text select doctor;
                foreach (var a in q)
                {
                    Session["doctorname"] = a.name;
                    Session["doctorId"]   = a.doctorid;
                }

                //  Session["username"] = email_tb.Text;
                Response.Redirect("DoctorHome.aspx");
            }
            else
            {
                error.Text = "email or password is incorrect";
                //Response.Redirect("login.aspx");
            }
        }
Example #19
0
 //get doctor advices as json string
 public JsonResult doctorAdvices(int pageNumber = 1, byte pageSize = 10, string doctorID = null)
 {
     try
     {
         doctor doctor = null;
         if (doctorID == null)
         {
             doctor = getCurrentDoctor();
         }
         else
         {
             Guid id = Guid.Parse(doctorID);
             db.doctors.Single(d => d.id == id);
         }
         var doctorAdvices = doctor.advices.Select(ad =>
                                                   new
         {
             date    = ad.dateOfJoin,
             content = ad.adviceContent,
             ad.id,
             comments = ad.commentOnAdvices.Count(c => c.comment != null),
             likes    = ad.commentOnAdvices.Count(c => c.like == true),
             shares   = ad.commentOnAdvices.Count(c => c.share == true),
             seens    = ad.commentOnAdvices.Count(c => c.like == true || c.comment != null || c.share == true)
         })
                             .OrderByDescending(c => c.date)
                             .Skip((pageNumber - 1) * pageSize).Take(pageSize)
                             .Select(c => new { c.id, c.content, c.comments, c.likes, c.seens, c.shares }).ToList();
         return(Json(new { status = true, data = doctorAdvices, total = doctor.advices.Count }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
     }
 }
Example #20
0
 public HttpResponseMessage Put(int id, doctor Doctor)
 {
     using (multimedia_db2Entities1 db = new multimedia_db2Entities1())
     {
         try
         {
             var doctor = db.doctors.FirstOrDefault(d => d.id == id);
             if (Doctor == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "There is no such user"));
             }
             else
             {
                 doctor.doctorNmae  = Doctor.doctorNmae;
                 doctor.doctorMail  = Doctor.doctorMail;
                 doctor.doctorImage = Doctor.doctorImage;
                 doctor.doctorTitle = Doctor.doctorTitle;
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, Doctor));
             }
         }
         catch (Exception exc)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exc));
         }
     }
 }
Example #21
0
        public void b_editDoctorInDataBase()
        {
            Edit   editClass  = new Edit();
            doctor testObject = new doctor(201067881, "Doctor", "Test", "male", 30000.0, "0");

            Assert.IsTrue(editClass.editParam(testObject, "firstName", "editTest"));
        }
Example #22
0
        public async Task <doctor> createdoctor(doctor doctor1)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://slamtk1.somee.com/api/odata/DoctorsGet");
            var json             = JsonConvert.SerializeObject(doctor1);
            var content          = new StringContent(json, Encoding.UTF8, "application/json");
            HttpRequestMessage h = new HttpRequestMessage();

            h.Content    = content;
            h.Method     = HttpMethod.Post;
            h.RequestUri = client.BaseAddress;
            HttpResponseMessage response = await client.SendAsync(h);

            if (response.IsSuccessStatusCode)
            {
                var response1 = await response.Content.ReadAsStringAsync();

                doctor result  = JsonConvert.DeserializeObject <doctor>(response1);
                doctor result1 = result;
                return(result1);
            }
            else
            {
                doctor dc2 = new doctor()
                {
                    ID = 0,
                };
                return(dc2);
            }
        }
Example #23
0
    public static doctor doc_specialist(string name)
    {
        string query = String.Format("select emp_doc_specialistid from employee_doctor where emp_doc_name = '{0}'", name);

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                int spec_id = reader.GetInt32(0);



                doctor doc = new doctor(spec_id);
                return(doc);
            }
        }
        finally
        {
            conn.Close();
        }

        return(null);
    }
Example #24
0
    public static doctor doc_specialist_id(int spc_id)
    {
        string query = String.Format("select emp_doc_specialist from specialist where emp_doc_specialistid = {0}", spc_id);

        try
        {
            conn.Open();
            command.CommandText = query;
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                string specname = reader.GetString(0);



                doctor doc = new doctor(specname);
                return(doc);
            }
        }
        finally
        {
            conn.Close();
        }

        return(null);
    }
Example #25
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.Columns[e.ColumnIndex].HeaderText == "Delete")
            {
                if (MessageBox.Show("Do you want to delete this " + type + " ?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    int dni      = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[2].Value);
                    int personId = servPerson.GetPersonByDni(dni).ID;
                    if (type == "Nurse")
                    {
                        nurse objNurse = new nurse();
                        objNurse = nurseService.GetNurseByPersonId(personId);
                        nurseService.DeleteNurse(objNurse.id);
                    }
                    else if (type == "Doctor")
                    {
                        doctor objDoctor = new doctor();
                        objDoctor = doctorService.GetDoctorByPersonId(personId);
                        doctorService.DeleteDoctor(objDoctor.id);
                    }
                    else if (type == "Patient")
                    {
                        patient objPatient = new patient();
                        objPatient = patientService.GetPatientByPersonId(personId);
                        patientService.DeletePatient(objPatient.id);
                    }

                    dataGridView1.DataBindings.Clear();
                    loadPersons();
                }
            }
        }
Example #26
0
        protected void register_btn_Click(object sender, EventArgs e)
        {
            AdminClass a = new AdminClass();
            //Create Patient class and assign values to it.
            doctor d = createDoctorObject();
            bool   alreadyRegistered = a.registered(d);

            if (alreadyRegistered)
            {
                ErrorL.Text = "Already Registered";
            }
            else
            {
                //Register Patient
                bool registerSucceeded = a.addDoctor(d);

                if (registerSucceeded == true)
                {
                    Response.Redirect("AdminViewDoctor.aspx");
                }
                else
                {
                    ErrorL.Text = "Whoops";
                }
            }
        }
Example #27
0
        // GET: Hotel/Edit/5
        public ActionResult Edit(int id)
        {
            doctor h = a.getDoctorById(id);

            a.deleteDoctorById(id);
            return(View(h));
        }
Example #28
0
        protected void Page_Init(object sender, EventArgs e)
        {
            DoctorClass ac = new DoctorClass();

            if (Session["EditDrId"] == null)
            {
                Server.Transfer("AdminViewDoctor.aspx");
            }

            d           = ac.getDoctor(Int32.Parse(Session["EditDrId"].ToString()));
            ErrorL.Text = Session["EditDrId"].ToString();
            //Set PresentValues
            //Copy paste from DoctorEditProfile
            if (!this.IsPostBack)
            {
                dob.Text           = d.dob.ToString("dd-MM-yyyy");
                Salary.Text        = d.salary.ToString();
                first_name_tb.Text = d.name;
                Email_tb.Text      = d.email;
                phoneno_tb.Text    = d.phoneno;
                Address_tb.Text    = d.address;
                Field.Text         = d.field;
                Qualification.Text = d.qualification;
            }
        }
Example #29
0
 //get doctor patient views as json string
 public JsonResult doctorPatientViews(int pageNumber = 1, byte pageSize = 10, string doctorID = null)
 {
     try
     {
         doctor doctor = null;
         if (doctorID == null)
         {
             doctor = getCurrentDoctor();
         }
         else
         {
             Guid id = Guid.Parse(doctorID);
             doctor = db.doctors.Single(d => d.id == id);
         }
         var patientViews = doctor.patientViews.Select(pv =>
                                                       new
         {
             comment     = (pv.comment == null)?"":pv.comment,
             patientName = pv.patient.username,
             pv.rate
         })
                            .OrderByDescending(a => a.rate)
                            .Skip((pageNumber - 1) * pageSize).Take(pageSize)
                            .ToList();
         var count = doctor.patientViews.Count;
         return(Json(new { status = true, data = patientViews, total = count }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new{ doctorStatus = false }, JsonRequestBehavior.AllowGet));
     }
 }
Example #30
0
        public ActionResult Create([Bind(Include = "id,password,gender,first_Name,last_Name,email,phone_number,role")] user user)
        {
            if (ModelState.IsValid)
            {
                user.last_LoginTime = DateTime.Now;
                //deploy role
                if (user.role == "Doctor")
                {
                    doctor doctor = new doctor();
                    doctor.id = user.id;
                    db.doctors.Add(doctor);
                }
                else if (user.role == "Administrator")
                {
                    administrator administrator = new administrator();
                    administrator.id = user.id;
                    db.administrators.Add(administrator);
                }
                else if (user.role == "Stomalogist")
                {
                    stomatologist stomatologist = new stomatologist();
                    stomatologist.id = user.id;
                    db.stomatologists.Add(stomatologist);
                }
                else
                {
                    ModelState.AddModelError("", "Please enter correct role");
                    return(View());
                }

                db.users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            List <SelectListItem> roleList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text  = "Administrator",
                    Value = "Administrator",
                },
                new SelectListItem
                {
                    Text  = "Doctor",
                    Value = "Doctor",
                },
                new SelectListItem
                {
                    Text  = "Stomalogist",
                    Value = "Stomalogist",
                }
            };

            ViewBag.roleSelectList = new SelectList(roleList, "Value", "Text");

            return(RedirectToAction("Index", "Administrators"));
        }
Example #31
0
    public bool commitInsert(string _fname, string _lname, string _uname, string _pass, int _phone, string _email)
    {
        doctorsDataContext objDoctorDC = new doctorsDataContext();
        using (objDoctorDC)
        {
            doctor objNewDoctor = new doctor();
            objNewDoctor.firstname = _fname;
            objNewDoctor.lastname = _lname;
            objNewDoctor.username = _uname;
            objNewDoctor.passwd = _pass;
            objNewDoctor.phone = _phone;
            objNewDoctor.email = _email;

            objDoctorDC.doctors.InsertOnSubmit(objNewDoctor);
            objDoctorDC.SubmitChanges();
            return true;
        }
    }
Example #32
0
        public ActionResult addDoc()
        {
            string name = Request.Form["name"];
            string address = Request.Form["address"];
            int supplierId = int.Parse(Request.Form["supplier"]);

            teethLabEntities db = new teethLabEntities();
            doctor doc = new doctor();
            doc.name = name;
            doc.address = address;
            doc.depit = 0;
            doc.isActive = false;
            if (supplierId != 0)
                doc.supplierId = supplierId;
            db.doctors.Add(doc);
            db.SaveChanges();

            return Redirect(Url.Action("Index", "Doctor"));
        }
Example #33
0
 partial void Updatedoctor(doctor instance);
Example #34
0
 partial void Deletedoctor(doctor instance);
Example #35
0
 partial void Insertdoctor(doctor instance);
Example #36
0
 public bool addnewdoctor(doctor doc)
 {
     this.context.doctors.Add(doc);
     this.context.SaveChanges();
     this.context = new teethLabEntities();
     return true;
 }