public async Task <IActionResult> PutDoctorProfile([FromRoute] int id, [FromBody] DoctorProfile doctorProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != doctorProfile.Recid)
            {
                return(BadRequest());
            }

            _context.Entry(doctorProfile).State = EntityState.Modified;

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public ActionResult Edit(DoctorProfile requestDoctorProfile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DoctorProfile a = db.DoctorsProfiles.Find(User.Identity.GetUserId());


                    if (TryUpdateModel(a))
                    {
                        a.DoctorName  = requestDoctorProfile.DoctorName;
                        a.Description = requestDoctorProfile.Description;
                        db.SaveChanges();
                        TempData["message"] = "Profilul a fost modificat!";
                    }
                    return(RedirectToAction("Show", "DoctorProfile"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        public static string UpdateUser(DoctorManage _updateUser, Guid _pkey)
        {
            string msg = "Error";

            try
            {
                GuruETCEntities _etc     = new GuruETCEntities();
                DoctorProfile   _profile = _etc.DoctorProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault();
                if (_profile != null)
                {
                    _profile.Name        = _updateUser.Name;
                    _profile.Practice    = _updateUser.Practice;
                    _profile.PhoneNumber = _updateUser.PhoneNumber;
                    _profile.Address1    = _updateUser.Address1;
                    _profile.Address2    = _updateUser.Address2;
                    _profile.DOB         = Convert.ToDateTime(_updateUser.DDOB);
                    _etc.SaveChanges();
                    msg = "Success";
                }
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
Ejemplo n.º 4
0
        public JsonResult GetProfile()
        {
            CheckOnClick.Models.DoctorProfile profile = new DoctorProfile();
            // string LiveAdmin = Session["AdminUserName"].ToString();
            string LiveDoc = Session["DoctorUserName"].ToString();
            //string LiveDoc = "jnp";
            DataSet data = profile.getProfileDetails(LiveDoc);

            List <DoctorProfile> profileList = new List <DoctorProfile>();


            foreach (DataRow dr in data.Tables[0].Rows)
            {
                profileList.Add(new DoctorProfile
                {
                    Name          = dr["STAFF_NAME"].ToString(),
                    Specification = dr["SPEC_NAME"].ToString(),
                    BloodGroup    = dr["STAFF_BLOODGP"].ToString(),
                    Email         = dr["STAFF_EMAIL"].ToString(),
                    Contact       = dr["STAFF_CONTACT"].ToString(),
                    DOBdoctor     = dr["STAFF_DOB"].ToString(),
                    City          = dr["STAFF_CITY"].ToString(),
                    State         = dr["STAFF_STATE"].ToString(),
                    Country       = dr["STAFF_COUNTRY"].ToString(),
                    Gender        = dr["STAFF_GENDER"].ToString(),
                    Pincode       = Convert.ToString(dr["STAFF_PIN"])
                });
            }

            return(Json(profileList, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public ActionResult New()
        {
            DoctorProfile dr = new DoctorProfile();

            dr.UserId = User.Identity.GetUserId();
            return(View(dr));
        }
Ejemplo n.º 6
0
        public static string RegisterDoctor(DoctorManage _newuser, Guid getuserkey)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            long   AdminId = _etc.AdminProfiles.Where(d => d.UserGuid == getuserkey).Select(d => d.Id).FirstOrDefault();
            string msg     = string.Empty;
            MembershipCreateStatus sts;

            try
            {
                Membership.CreateUser(_newuser.UserName, _newuser.Password, _newuser.Email, null, null, true, out sts);
                if (sts == MembershipCreateStatus.Success)
                {
                    MembershipUser _getUser = Membership.GetUser(_newuser.UserName);
                    if (_getUser != null)
                    {
                        Roles.AddUserToRole(_getUser.UserName, "Doctor");
                        DoctorProfile _prof = new DoctorProfile()
                        {
                            UserGuid = (Guid)_getUser.ProviderUserKey, PhoneNumber = _newuser.PhoneNumber, Address1 = _newuser.Address1, Address2 = _newuser.Address2, DOB = DateTime.Parse(_newuser.DDOB), Name = _newuser.Name, Practice = _newuser.Practice, AdminId = AdminId
                        };
                        _etc.AddToDoctorProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "Success";
                    }
                }
            }
            catch
            {
                msg = "Error";
            }

            return(msg);
        }
Ejemplo n.º 7
0
            public async Task <IActionResult> ProfileSettings(DoctorProfileViewModel model)
            {
                if (ModelState.IsValid)
                {
                    string uniqueFileName = null;

                    if (model.ProfilePhoto != null)
                    {
                        string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                        //uniqueFileName = Guid.NewGuid().ToString() + "_" + model.ProfilePhoto.FileName;
                        uniqueFileName = Guid.NewGuid().ToString() + "_" + Path.GetFileName(model.ProfilePhoto.FileName);
                        string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                        model.ProfilePhoto.CopyTo(new FileStream(filePath, FileMode.Create));
                    }

                    DoctorProfile dp = new DoctorProfile
                    {
                        id                     = model.id,
                        Title                  = model.Title,
                        FirstName              = model.FirstName,
                        LastName               = model.LastName,
                        SubTitle               = model.SubTitle,
                        ProfilePhoto           = uniqueFileName,
                        facebooklink           = model.facebooklink,
                        twitterlink            = model.twitterlink,
                        linkedin               = model.linkedin,
                        googlepluslink         = model.googlepluslink,
                        rsslink                = model.rsslink,
                        youtubelink            = model.youtubelink,
                        Specializations        = model.Specializations,
                        Designation            = model.Designation,
                        CompanyName            = model.CompanyName,
                        startingDateExperience = model.startingDateExperience,
                        EndingDateExperience   = model.EndingDateExperience,
                        DegreeName             = model.DegreeName,
                        InstituteName          = model.InstituteName,
                        StartingDateStudy      = model.StartingDateStudy,
                        EndingDateStudy        = model.EndingDateStudy,
                        Languages              = model.Languages,
                        AwardTitle             = model.AwardTitle,
                        AwardOccasion          = model.AwardOccasion,
                        AwardDate              = model.AwardDate,
                        MembershipTitle        = model.MembershipTitle,
                        MembershipLocation     = model.MembershipLocation,
                        MembershipDate         = model.MembershipDate,
                        RegistrationID         = model.RegistrationID,
                        RegistrationLocation   = model.RegistrationLocation,
                        RegistrationDate       = model.RegistrationDate,
                        AcceptedInsurance      = model.AcceptedInsurance,
                        VideoIntroduction      = model.VideoIntroduction
                    };

                    //DoctorProfile dc=new DoctorProfile { }
                    _context.Add(dp);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Insights)));
                }
                return(View(model));
            }
Ejemplo n.º 8
0
        public ActionResult Show()
        {
            DoctorProfile a = db.DoctorsProfiles.Find(User.Identity.GetUserId());

            ViewBag.profile = a;

            return(View(a));
        }
Ejemplo n.º 9
0
        public ActionResult Delete()
        {
            DoctorProfile a = db.DoctorsProfiles.Find(User.Identity.GetUserId());

            db.DoctorsProfiles.Remove(a);
            db.SaveChanges();
            TempData["message"] = "Profilul a fost sters!";
            return(RedirectToAction("New", "DoctorProfile"));
        }
        public async Task <IActionResult> PostDoctorProfile([FromBody] DoctorProfile doctorProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.DoctorProfile.Add(doctorProfile);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDoctorProfile", new { id = doctorProfile.Recid }, doctorProfile));
        }
Ejemplo n.º 11
0
        public IHttpActionResult InsertUpdateDoctorProfile([FromBody] DoctorProfile doctorProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var DoctorBLObj = _Kernel.Get <IDoctorBL>();

            doctorProfile.Active = true;
            var doctorProfileResult = DoctorBLObj.InsertUpdateDoctorProfile(doctorProfile, null);

            return(Ok(doctorProfileResult.Message));
        }
Ejemplo n.º 12
0
        public DoctorProfileResponse InsertUpdateDoctorProfile(DoctorProfile doctorProfile, string operation)
        {
            try
            {
                Log.Info("Started call to InsertUpdateDoctorProfile");
                Log.Info("parameter values" + JsonConvert.SerializeObject(new { doctorProfile = doctorProfile, operation = operation }));
                Command.CommandText = "SP_DOCTOR_PROFILE_MANAGER";
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.Clear();

                Command.Parameters.AddWithValue("@DOCTOR_PROFILE_XML", GetXMLFromObject(doctorProfile));
                if (!string.IsNullOrEmpty(operation))
                {
                    Command.Parameters.AddWithValue("@OPERATION", operation);
                }
                if (doctorProfile.AddedBy.HasValue)
                {
                    Command.Parameters.AddWithValue("@USER_ID", doctorProfile.AddedBy.Value);
                }
                else if (doctorProfile.ModifiedBy.HasValue)
                {
                    Command.Parameters.AddWithValue("@USER_ID", doctorProfile.ModifiedBy.Value);
                }
                Connection.Open();
                SqlDataReader reader = Command.ExecuteReader();

                DoctorProfileResponse result = new DoctorProfileResponse();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        result = new DoctorProfileResponse
                        {
                            Message   = reader["ReturnMessage"] != DBNull.Value ? reader["ReturnMessage"].ToString() : null,
                            IsSuccess = Convert.ToBoolean(reader["Result"].ToString())
                        };
                    }
                }
                Log.Info("End call to InsertUpdateDoctorProfile");

                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                Connection.Close();
            }
        }
        public HomeController(ILogger <HomeController> logger)
        {
            _logger = logger;

            //inheritence from PersonalDetails to DoctorProfile
            DoctorProfile Vicran = new DoctorProfile()
            {
                FirstName  = "Vikrant Shrestha",
                Address    = "Kathmnandu",
                Age        = 21,
                Occupation = "Doctor",
                //DoctorProfile specific property
                HospitalClinic = "Grande Hospital",
                Qualification  = "MD",
                Speciality     = "NeuroSurgeon"
            };

            detailList.Add(Vicran);


            //inheritence from PersonalDetails to TeacherProfile
            TeacherProfile Sinke = new TeacherProfile()
            {
                FirstName  = "Aman Butthe",
                Address    = "Darjeeling",
                Age        = 20,
                Occupation = "Teacher",
                //TeacherProfile specific property
                Qualification      = "B.Ed.",
                Institute          = "JMC",
                AssociatedSubjects = "Mathematics"
            };

            detailList.Add(Sinke);


            //inheritence from PersonalDetails to StudentProfile
            StudentProfile Sallu = new StudentProfile()
            {
                FirstName  = "Salina Awal",
                Address    = "Bhaktapur",
                Age        = 23,
                Occupation = "Student",
                //StudentProfile specific property
                Faculty        = "Architecture",
                College_School = "Pulchowk",
                Rollno         = 15162
            };

            detailList.Add(Sallu);
        }
Ejemplo n.º 14
0
 public ActionResult New(DoctorProfile dr)
 {
     try
     {
         db.DoctorsProfiles.Add(dr);
         db.SaveChanges();
         TempData["message"] = "Profilul a fost adaugat!";
         return(RedirectToAction("Index", "Home"));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
Ejemplo n.º 15
0
        public void NewTestWhenNewProfileIsCreated()
        {
            DoctorProfile dr            = new DoctorProfile();
            var           dbContextMock = new Mock <ApplicationDbContext>();
            var           dbSetMock     = new Mock <DbSet <DoctorProfile> >();

            dbSetMock.Setup(m => m.Add(dr));
            dbContextMock.Setup(m => m.DoctorsProfiles).Returns(dbSetMock.Object);
            dbContextMock.Setup(m => m.DoctorsProfiles.Add(dr));
            DoctorProfileController controller = new DoctorProfileController(dbContextMock.Object);

            controller.New(dr);
            dbContextMock.Verify(m => m.DoctorsProfiles.Add(dr), Times.Once());
        }
Ejemplo n.º 16
0
        public JsonResult PasswordValidation(DoctorProfile doctor)
        {
            PezeshkPlusEntities db = new PezeshkPlusEntities();

            USP_SEL_Doctor_Result doctorLastInfo = (USP_SEL_Doctor_Result)Session["DoctorInfo"];

            List <int?> CheckPassword = db.USP_SEL_Password(doctorLastInfo.Email, doctor.Password).ToList();

            if (CheckPassword.Count == 0)
            {
                return(Json("پسورد وارد شده اشتباه است", JsonRequestBehavior.DenyGet));
            }
            return(Json(true, JsonRequestBehavior.DenyGet));
        }
Ejemplo n.º 17
0
        public ActionResult ProfileSet()
        {
            string authID = Request.Cookies["AuthID"].Value;

            PezeshkPlusEntities          db         = new PezeshkPlusEntities();
            List <USP_SEL_Doctor_Result> doctorInfo = db.USP_SEL_Doctor(Session[authID].ToString()).ToList();

            Session["DoctorInfo"] = doctorInfo[0];

            ViewBag.MedicalFields = db.USP_SEL_MedicalFields().ToList();

            DoctorProfile model = new DoctorProfile();

            return(View(model));
        }
Ejemplo n.º 18
0
 public DoctorProfileResponse InsertUpdateDoctorProfile(DoctorProfile doctorProfile, string operation)
 {
     try
     {
         return(this._doctorDA.InsertUpdateDoctorProfile(doctorProfile, operation));
     }
     catch (Exception ex)
     {
         throw;
     }
     finally
     {
         //Log
     }
 }
Ejemplo n.º 19
0
        public void EndEdit()
        {
            trn_carotid_tech obj = _PatientRegis.trn_carotid_teches.FirstOrDefault();

            if (autoCompleteUC1.SelectedItem != null)
            {
                DoctorProfile dc = (DoctorProfile)autoCompleteUC1.SelectedItem;
                obj.tct_doctor_code = dc.SSUSR_Initials;
                obj.tct_doctor_name = dc.CTPCP_Desc;
            }
            else
            {
                obj.tct_doctor_code = null;
                obj.tct_doctor_name = null;
            }
        }
Ejemplo n.º 20
0
        public static DoctorManage GetDoctorRecord(Guid _getUserkey)
        {
            DoctorManage    _edituser = new DoctorManage();
            GuruETCEntities _etc      = new GuruETCEntities();
            DoctorProfile   _profile  = _etc.DoctorProfiles.Where(d => d.UserGuid == _getUserkey).FirstOrDefault();

            if (_profile != null)
            {
                _edituser.PhoneNumber = _profile.PhoneNumber;
                _edituser.DDOB        = _profile.DOB.Value.ToShortDateString();
                _edituser.Address1    = _profile.Address1;
                _edituser.Address2    = _profile.Address2;
                _edituser.Name        = _profile.Name;
                _edituser.Practice    = _profile.Practice;
            }
            return(_edituser);
        }
        public async Task <IActionResult> DoctorRegister(RegisterDoctorViewModel model)
        {
            if (ModelState.IsValid)
            {
                var roleName = "Doctor";
                if (model.ImageName == null)
                {
                    model.ImageName = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR_q1QWy4q604M8nPCoHqq1rR8OCoQ3wx5iRScLfgjO7F1-gwdH";
                }
                DoctorProfile doctor = new DoctorProfile()
                {
                    Login            = model.Login,
                    FirstName        = model.FirstName,
                    LastName         = model.LastName,
                    Experience       = model.Experience,
                    SpecializationId = Convert.ToInt32(model.SicknessId),
                    HospitalId       = 1,
                    Image            = model.ImageName
                };
                var dbUser = new DbUser()
                {
                    Email          = model.Email,
                    UserName       = model.Email,
                    DoctorProfiles = doctor
                };
                var result = await _userManager.CreateAsync(dbUser, model.Password);

                result = _userManager.AddToRoleAsync(dbUser, roleName).Result;
                if (result.Succeeded)
                {
                    // установка куки
                    await _signInManager.SignInAsync(dbUser, false);

                    return(RedirectToAction("Login", "Home"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError(string.Empty, error.Description);
                    }
                }
            }
            return(View(model));
        }
Ejemplo n.º 22
0
        public IActionResult DoctorGet(string hospitalName, Occupation occupation)
        {
            DoctorProfile docProfile = _profileDb.DoctorProfiles.FirstOrDefault(
                d => d.HospitalName == hospitalName && d.Occupation == occupation);

            var jsonResult = new JsonResult(new
            {
                docProfile.FirstName,
                docProfile.LastName,
                docProfile.HospitalName,
                Occupation = docProfile.Occupation.ToString(),
                docProfile.Experience
            })
            {
                StatusCode = docProfile == null ? 404 : 200
            };

            return(jsonResult);
        }
Ejemplo n.º 23
0
        public DoctorProfileResponse DeleteDoctorProfile(int doctorProfileId, int userId)
        {
            try
            {
                Log.Info("Started call to DeleteDoctorProfile");
                Log.Info("parameter values" + JsonConvert.SerializeObject(new { doctorProfileId = doctorProfileId, userId = userId }));
                Command.CommandText = "SP_DOCTOR_PROFILE_MANAGER";
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.Clear();
                var doctorProfile = new DoctorProfile {
                    Id = doctorProfileId, DeletedBy = userId
                };
                Command.Parameters.AddWithValue("@DOCTOR_PROFILE_XML", GetXMLFromObject(doctorProfile));
                Command.Parameters.AddWithValue("@OPERATION", "SOFT_DELETE");
                Connection.Open();
                SqlDataReader reader = Command.ExecuteReader();

                DoctorProfileResponse result = new DoctorProfileResponse();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        result = new DoctorProfileResponse
                        {
                            Message   = reader["ReturnMessage"] != DBNull.Value ? reader["ReturnMessage"].ToString() : null,
                            IsSuccess = Convert.ToBoolean(reader["Result"].ToString())
                        };
                    }
                }
                Log.Info("End call to DeleteDoctorProfile");

                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                Connection.Close();
            }
        }
Ejemplo n.º 24
0
        public async Task <ActionResult <DoctorProfile> > GetDoctorProfile([FromRoute] int id)
        {
            var doctor = await _context.Doctors.FindAsync(id);

            if (doctor == null)
            {
                return(NotFound());
            }
            DoctorProfile doctorProfile = new DoctorProfile
            {
                ID          = doctor.ID,
                Name        = doctor.Name,
                City        = doctor.City,
                Address     = doctor.Address,
                Information = doctor.Information,
                Rating      = myApp.CalculateDoctorRating(doctor.ID)
            };

            return(doctorProfile);
        }
Ejemplo n.º 25
0
        public ActionResult ShowMyProfile()
        {
            ViewBag.IsDoctor  = User.IsInRole("Doctor");
            ViewBag.IsPatient = User.IsInRole("User");



            if (ViewBag.IsDoctor == true)
            {
                DoctorProfile profile = db.DoctorsProfiles.Find(User.Identity.GetUserId());
                if (profile != null)  /// are fisa completata
                {
                    return(RedirectToAction("Show", "DoctorProfile"));
                }
                else
                {
                    return(RedirectToAction("New", "DoctorProfile"));
                }
            }
            else
            if (ViewBag.IsPatient == true)
            {
                PatientProfile profile = db.PatientsProfiles.Find(User.Identity.GetUserId());
                if (profile != null)
                {
                    return(RedirectToAction("Show", "PatientProfile"));
                }
                else
                {
                    return(RedirectToAction("New", "PatientProfile"));
                }
            }

            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 26
0
        // Get doctor profile detail
        public DoctorProfile GetDoctorProfile(int userId)
        {
            // Find patient account
            var user = db.TM_Users.Find(userId);

            if (user == null)
            {
                return(null);
            }
            var doctor = db.TM_Doctor.Where(p => p.UserId == userId).FirstOrDefault();

            if (doctor == null)
            {
                doctor = new TM_Doctor()
                {
                    Major = string.Empty, IdentityCard = string.Empty
                };
            }
            // Find

            var model = new DoctorProfile();

            model.Id           = user.Id;
            model.UserName     = user.UserName;
            model.FullName     = user.FullName;
            model.Gender       = user.Gender;
            model.Avatar       = user.Avatar;
            model.DoB          = user.DateOfBirth;
            model.Email        = user.Email;
            model.PhoneNumber  = user.PhoneNumber;
            model.Major        = doctor.Major;
            model.IdentityCard = doctor.IdentityCard;
            model.Addresses    = GetAddresses(userId);


            return(model);
        }
Ejemplo n.º 27
0
        public static DoctorManage EditUser(int id, Guid _adminkey)
        {
            DoctorManage    _edituser      = new DoctorManage();
            GuruETCEntities _etc           = new GuruETCEntities();
            long?           adminKey       = _etc.AdminProfiles.Where(d => d.UserGuid == _adminkey).Select(d => d.Id).FirstOrDefault();
            DoctorProfile   _profile       = _etc.DoctorProfiles.Where(d => d.Id == id).FirstOrDefault();
            MembershipUser  _getUserbyName = Membership.GetUser(_profile.UserGuid);

            if (_profile != null)
            {
                if (_profile.AdminId == adminKey)
                {
                    _edituser.Email       = _getUserbyName.Email;
                    _edituser.UserName    = _getUserbyName.UserName;
                    _edituser.PhoneNumber = _profile.PhoneNumber;
                    _edituser.DDOB        = _profile.DOB.Value.ToShortDateString();
                    _edituser.Address1    = _profile.Address1;
                    _edituser.Address2    = _profile.Address2;
                    _edituser.Name        = _profile.Name;
                    _edituser.Practice    = _profile.Practice;
                }
            }
            return(_edituser);
        }
Ejemplo n.º 28
0
 public DoctorModel()
 {
     DoctorProfileObject = new DoctorProfile();
 }
Ejemplo n.º 29
0
        public ActionResult SearchBox(DoctorProfile pModel)
        {
            Search model = pModel.SearchModel;

            return(RedirectToAction("Index", model));
        }
Ejemplo n.º 30
0
        public ActionResult ProfileSet(DoctorProfile doctorProfile)
        {
            try
            {
                USP_SEL_Doctor_Result doctorLastInfo = (USP_SEL_Doctor_Result)Session["DoctorInfo"];
                Session.Remove("DoctorInfo");

                PezeshkPlusEntities db = new PezeshkPlusEntities();

                if (doctorProfile.FirstName != doctorLastInfo.FirstName)
                {
                    db.USP_UPD_FirstName(doctorLastInfo.Email, doctorProfile.FirstName);
                }
                if (doctorProfile.LastName != doctorLastInfo.LastName)
                {
                    db.USP_UPD_LastName(doctorLastInfo.Email, doctorProfile.LastName);
                }

                if (doctorProfile.Password != null)
                {
                    if (doctorProfile.NewPassword != null)
                    {
                        db.USP_UPD_Password(doctorLastInfo.Email, doctorProfile.NewPassword);
                    }
                }

                if (doctorProfile.PhoneNumber != doctorLastInfo.PhoneNumber)
                {
                    List <int?> CheckPhoneNumber = db.USP_SEL_PhoneNumber(doctorProfile.PhoneNumber).ToList();
                    if (CheckPhoneNumber.Count == 1)
                    {
                        TempData["PhoneNumberError"] = "با این شماره موبایل قبلا ثبت نام شده است";
                        return(RedirectToAction("ProfileSet"));
                    }
                    db.USP_UPD_PhoneNumber(doctorLastInfo.Email, doctorProfile.PhoneNumber);
                }

                if (doctorProfile.ClinicPhone != doctorLastInfo.ClinicPhone)
                {
                    List <int?> CheckClinicPhone = db.USP_SEL_ClinicPhone(doctorProfile.ClinicPhone).ToList();
                    if (CheckClinicPhone.Count == 1)
                    {
                        TempData["ClinicPhoneError"] = "با این شماره تلفن مطب قبلا ثبت نام شده است";
                        return(RedirectToAction("ProfileSet"));
                    }
                    db.USP_UPD_ClinicPhone(doctorLastInfo.Email, doctorProfile.ClinicPhone);
                }

                if (doctorProfile.Province != doctorLastInfo.Province)
                {
                    db.USP_UPD_Province(doctorLastInfo.Email, doctorProfile.Province);
                }
                if (doctorProfile.City != doctorLastInfo.City)
                {
                    db.USP_UPD_City(doctorLastInfo.Email, doctorProfile.City);
                }
                if (doctorProfile.Address != doctorLastInfo.Address)
                {
                    db.USP_UPD_Address(doctorLastInfo.Email, doctorProfile.Address);
                }

                if (doctorProfile.NationalID != doctorLastInfo.NationalID)
                {
                    List <int?> CheckNationalID = db.USP_SEL_NationalID(doctorProfile.NationalID).ToList();
                    if (CheckNationalID.Count == 1)
                    {
                        TempData["NationalIDError"] = "با این کد ملی قبلا ثبت نام شده است";
                        return(RedirectToAction("ProfileSet"));
                    }
                    db.USP_UPD_NationalID(doctorLastInfo.Email, doctorProfile.NationalID);
                }

                if (doctorProfile.MedicalField != doctorLastInfo.MedicalField)
                {
                    List <int?> previousMedicalFieldID = db.USP_SEL_MedicalFieldID(doctorLastInfo.MedicalField).ToList();
                    List <int?> medicalFieldID         = db.USP_SEL_MedicalFieldID(doctorProfile.MedicalField).ToList();
                    db.USP_UPD_MedicalField(doctorLastInfo.Email, previousMedicalFieldID[0], medicalFieldID[0]);
                }
                if (doctorProfile.WorkTime != doctorLastInfo.WorkTime)
                {
                    db.USP_UPD_WorkTime(doctorLastInfo.Email, doctorProfile.WorkTime);
                }
                if (doctorProfile.Picture != null)
                {
                    if (Path.GetExtension(doctorProfile.Picture.FileName) != ".jpg" && Path.GetExtension(doctorProfile.Picture.FileName) != ".JPG" && Path.GetExtension(doctorProfile.Picture.FileName) != ".png" && Path.GetExtension(doctorProfile.Picture.FileName) != ".PNG" && Path.GetExtension(doctorProfile.Picture.FileName) != ".jpeg")
                    {
                        TempData["PictureError"] = "پسوند فایل ارسالی باید jpg یا jpeg یا png باشد";
                        return(RedirectToAction("ProfileSet"));
                    }
                    if (doctorProfile.Picture.ContentLength > 1 & doctorProfile.Picture.ContentLength < (5 * 1024 * 1024))
                    {
                        if (doctorLastInfo.PicAddress != null)
                        {
                            if (System.IO.File.Exists(doctorLastInfo.PicAddress))
                            {
                                System.IO.File.Delete(doctorLastInfo.PicAddress);
                            }
                        }
                        string extention   = Path.GetExtension(doctorProfile.Picture.FileName);
                        string guidNamePic = Guid.NewGuid().ToString();
                        string picAddress  = $"/Images/Doctors/{guidNamePic}{extention}";
                        doctorProfile.Picture.SaveAs(Server.MapPath("~" + $"{picAddress}"));
                        db.USP_UPD_PicAddress(doctorLastInfo.Email, picAddress);
                    }
                    else
                    {
                        TempData["PictureError"] = "سایز فایل عکس ارسال شده باید حداکثر 5 Mg باشد";
                        return(RedirectToAction("ProfileSet"));
                    }
                }
            }
            catch (Exception)
            {
                TempData["UpdateError"] = "خطایی در بروزرسانی اطلاعات رخ داد! لطفا مقادیر را چک کنید و دوباره تلاش کنید";
                return(RedirectToAction("ProfileSet"));
            }

            TempData["UpdateSuccessFully"] = "پروفایل شما با موفقیت بروزرسانی شد";
            return(RedirectToAction("ProfileSet"));
        }