public ActionResult ViewMessage()
        {
            using (ProjectEntities1 im = new ProjectEntities1())
            {
                DoctorModel docmodel = new DoctorModel();

                int memid  = Convert.ToInt32(Session["MemberId"]);
                var gdata2 = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                //var getdoc = im.Doctors.FirstOrDefault(a=>a.);

                var gdata = im.Inboxes.ToList().Where(a => a.ToEmailId == gdata2.EmailId);
                //gdata.FirstOrDefault
                List <InboxModel> lst = new List <InboxModel>();
                foreach (var item in gdata)
                {
                    string docmail = item.FromEmailId;
                    var    getdoc  = im.MemberLogins.FirstOrDefault(a => a.EmailId == docmail);

                    var    doc_get = im.Doctors.FirstOrDefault(a => a.MemberId == getdoc.MemberId);
                    string docname = doc_get.FirstName + " " + doc_get.LastName;
                    lst.Add(new InboxModel
                    {
                        DoctorName    = docname,
                        Subject       = item.Subject,
                        MessageDetail = item.MessageDetail,
                        MessageDate   = Convert.ToDateTime(item.MessageDate),
                        IsRead        = item.IsRead
                    });
                }
                InboxModel inboxViewModel = new InboxModel();
                inboxViewModel.doctorlist = lst;

                return(View(inboxViewModel));
            }
        }
Beispiel #2
0
 public void Edit(DoctorModel obj)
 {
     try
     {
         db.connection();
         db.con.Open();
         DynamicParameters param = new DynamicParameters();
         param.Add("@Doctor_ID", obj.Doctor_ID);
         param.Add("@Doctor_Specialty_ID", obj.Doctor_Specialty_ID);
         param.Add("@Doctor_Name", obj.Doctor_Name);
         param.Add("@Doctor_Experience", obj.Doctor_Experience);
         param.Add("@Hospital_ID", obj.Hospital_ID);
         param.Add("@Doctor_Education", obj.Doctor_Education);
         param.Add("@Doctor_Phone", obj.Doctor_Phone);
         param.Add("@Doctor_Address", obj.Doctor_Address);
         param.Add("@Doctor_Email", obj.Doctor_Email);
         param.Add("@Doctor_Review", obj.Doctor_Review);
         param.Add("@Doctor_Comment_ID", obj.Doctor_Comment_ID);
         db.con.Execute("UpdateDoctor", param, commandType: CommandType.StoredProcedure);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.con.Close();
     }
 }
        public async Task <IActionResult> GetDoctorByUsername([FromRoute] string username)
        {
            var findUser = await _userManager.FindByNameAsync(username);

            var findAssistant = _db.Assistants.FirstOrDefault(a => a.as_user_id == findUser.Id);

            if (findAssistant != null && findUser != null)
            {
                var findDoctor = _db.Doctors.FirstOrDefault(d => d.dr_id == findAssistant.as_dr_id);

                if (findDoctor != null && findUser != null)
                {
                    DoctorModel doctor = new DoctorModel();
                    doctor.dr_id         = findDoctor.dr_id;
                    doctor.dr_user_id    = findDoctor.dr_user_id;
                    doctor.dr_fname      = findDoctor.dr_fname;
                    doctor.dr_mname      = findDoctor.dr_mname;
                    doctor.dr_lname      = findDoctor.dr_lname;
                    doctor.dr_gender     = findDoctor.dr_gender;
                    doctor.dr_speciality = findDoctor.dr_speciality;
                    doctor.dr_address    = findDoctor.dr_address;
                    doctor.dr_about      = findDoctor.dr_about;

                    return(Ok(doctor));
                }
                return(NotFound());
            }

            else
            {
                return(NotFound());
            }
        }
 public ActionResult Index()
 {
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         string queryString = "SELECT * FROM Doctor";
         connection.Open();
         using (SqlCommand command = new SqlCommand(queryString, connection))
         {
             try
             {
                 SqlDataReader reader = command.ExecuteReader();
                 while (reader.Read())
                 {
                     DoctorModel model = new DoctorModel();
                     model.doctor_id      = (int)reader[0];
                     model.doctor_name    = (string)reader[1];
                     model.doctor_surname = (string)reader[2];
                     //model.patient_dateofbirth = (DateTime)reader[3];
                     //model.patient_address = (string)reader[4];
                     //model.patient_phonenumber = (string)reader[5];
                     //model.patient_city = (string)reader[6];
                     Doctors.Add(model);
                 }
                 reader.Close();
             }
             catch (Exception ex)
             {
                 throw new Exception("Error");
             }
         }
         return(View(Doctors));
     }
 }
 public ActionResult Delete(int?id)
 {
     if (id != null)
     {
         using (SqlConnection connection = new SqlConnection(connectionString))
         {
             string deleteString = @"DELETE FROM Doctor WHERE doctor_id = @id";
             connection.Open();
             using (SqlCommand command = new SqlCommand(deleteString, connection))
             {
                 try
                 {
                     command.Parameters.AddWithValue("@id", id);
                     SqlDataReader reader = command.ExecuteReader();
                     while (reader.Read())
                     {
                         DoctorModel model = new DoctorModel();
                         model.doctor_id      = (int)reader[0];
                         model.doctor_name    = (string)reader[1];
                         model.doctor_surname = (string)reader[2];
                         Doctors.Remove(model);
                     }
                     reader.Close();
                 }
                 catch (Exception ex)
                 {
                     throw new Exception("Error");
                 }
             }
         }
     }
     return(RedirectToAction("Index"));
 }
Beispiel #6
0
 public ActionResult EditProfile(DoctorModel model)
 {
     if (ModelState.IsValid)
     {
         var profile = new Doctor();
         profile.FirstName = model.FirstName;
         profile.LastName = model.LastName;
         profile.Gender = model.Gender;
         profile.MobileNumber = model.MobileNumber;
         profile.Age = model.Age;
         profile.Specialization = model.Specialization;
         _doctorService.EditProfile(profile, User.Identity.Name);
         //address
         var address = new Address();
         address.HouseNo = model.HouseNo;
         address.RoadNo = model.RoadNo;
         address.Thana = model.Thana;
         address.Zilla = model.Zilla;
         _doctorService.UpdateAddress(address, User.Identity.Name);
         Session["Success"] = "Profile Updated Successfully";
     }
     else
     {
         Session["Error"] = "Sorry, Profile Cannot Be Updated";
     }
     return View(model);
 }
Beispiel #7
0
        public ActionResult History(string id)
        {
            int  n;
            bool isInt = int.TryParse(id, out n);

            if (!isInt)
            {
                var         user   = db.ApplicationUsers.First(u => u.UserName == id);
                var         model  = new EditUserViewModel(user);
                DoctorModel doctor = db.Doctors.First(u => u.Name == user.Name);
                if (doctor == null)
                {
                    return(View("Error"));
                }
                doctor.Appointments.Sort();
                return(View(doctor));
            }
            else
            {
                if (!User.IsInRole("Admin"))
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                DoctorModel doctor = db.Doctors.Find(n);
                if (doctor == null)
                {
                    return(View("Error"));
                }
                doctor.Appointments.Sort();
                return(View(doctor));
            }
        }
Beispiel #8
0
        public List <DoctorModel> GetDoctors()
        {
            List <DoctorModel> doctors = new List <DoctorModel>();

            using (SqlConnection conn = new SqlConnection(Environment.GetEnvironmentVariable("sqldb_connection")))
            {
                string sqlQuery =
                    "SELECT d.*, a.first_name, a.last_name " +
                    "FROM Doctor AS d " +
                    "INNER JOIN Account AS a ON a.id = d.account_id";

                SqlCommand cmd = new SqlCommand(sqlQuery, conn);

                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    DoctorModel doctor = new DoctorModel();
                    doctor.FirstName = reader["first_name"].ToString();
                    doctor.LastName  = reader["last_name"].ToString();
                    doctor.DoctorId  = (int)reader["id"];
                    doctor.Location  = reader["location"].ToString();

                    doctors.Add(doctor);
                }
                conn.Close();
            }
            return(doctors.Count != 0
                ? doctors
                : null);
        }
        public async Task <ActionResult> InsertUpdate(DoctorModel doctor)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(ConfigurationManager.AppSettings["BaseUrl"]);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var json                = JsonConvert.SerializeObject(doctor.DoctorProfileObject);
                var content             = new StringContent(json, Encoding.UTF8, "application/json");
                HttpResponseMessage Res = await client.PostAsync("api/DoctorAPI/InsertUpdateDoctorProfile", content);

                DoctorProfileResponse result = new DoctorProfileResponse();
                if (Res.IsSuccessStatusCode)
                {
                    result.IsSuccess = true;
                    result.Message   = Res.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    result.IsSuccess = false;
                    result.Message   = Res.Content.ReadAsStringAsync().Result;
                }
                return(View("DoctorProfileResponse", result));
            }
        }
        public List <DoctorModel> GetAllDoctors()
        {
            String             myConnectionString = ConfigurationManager.ConnectionStrings["projectDatabase"].ConnectionString;
            SqlConnection      connection         = new SqlConnection(myConnectionString);
            DoctorModel        adoctor            = new DoctorModel();
            List <DoctorModel> doctors            = new List <DoctorModel>();

            connection.Open();

            SqlCommand cmd = new SqlCommand("select * from Doctor", connection);

            // create data adapter
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            // this will query your database and return the result to your datatable

            DataSet ds = new DataSet();

            da.Fill(ds);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                //RR_ID.Add(int.Parse(row.ItemArray.GetValue(0).ToString()));
                adoctor.Doctor_name   = row["Doctor_name"].ToString();
                adoctor.Doctor_email  = row["Doctor_email"].ToString();
                adoctor.Doctor_phone  = row["Doctor_phone"].ToString();
                adoctor.Doctor_gender = row["Doctor_gender"].ToString();
                adoctor.Doctor_field  = row["Doctor_field"].ToString();

                doctors.Add(adoctor);
            }

            connection.Close();
            return(doctors);
        }
        public async Task <HttpResponseMessage> Post([FromBody] DoctorModel mLabDoctor)
        {
            var formatter = RequestFormat.JsonFormaterString();

            try
            {
                string msg = "";
                if (_gt.FncSeekRecordNew("tbl_LAB_DOCTOR_INFO", "Id=" + mLabDoctor.DrId + ""))
                {
                    msg = await _gt.Update(mLabDoctor);
                }
                else
                {
                    msg = await _gt.Save(mLabDoctor);
                }
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    Output = "success", Msg = msg
                }, formatter));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    Output = "error", Msg = ex.ToString()
                }, formatter));
            }
        }
        public async Task <int> AddEditDoctor(DoctorModel model)
        {
            int rpta = 0;

            try
            {
                HttpClient          client      = new HttpClient();
                string              url         = "http://192.168.100.221:8081/Api/Doctor";
                var                 jsonRequest = JsonConvert.SerializeObject(model);
                var                 content     = new StringContent(jsonRequest, Encoding.UTF8, "text/json");
                HttpResponseMessage response    = await client.PostAsync(url, content);

                if (response != null)
                {
                    string rptaCadena = await response.Content.ReadAsStringAsync();

                    rpta = int.Parse(rptaCadena);
                }
            }
            catch (Exception ex)
            {
                rpta = 0;
            }

            return(rpta);
        }
Beispiel #13
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,FirstName,LastName,graduation_uni,isActivated,workplace,status,personalphonenumber,workphonenumber,ispart1comp,jma_number")] DoctorModel doctorModel)
        {
            if (id != doctorModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(doctorModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorModelExists(doctorModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctorModel));
        }
Beispiel #14
0
        async Task LoadData()
        {
            abc = ViewClinic.id_Clinic;
            //  string id_faculty_p = name;
            string sql = @"SELECT Employee.[Name] as Name_emp,[EmpNo_],[CliNo_],[FacultyNo_],Faculty.Name as Name_fac,[Address],[Phone No_] as Phone,[Picture], [System Setup].Server as sever FROM [Employee],[System Setup],Faculty where CliNo_='" + abc + "' and [System Setup].Blocked='0' and [System Setup].Status='2' and Employee.FacultyNo_=Faculty.FalNo_";

            try
            {
                JArray arr = await ex.getDataBFO(sql);

                foreach (var item in arr)
                {
                    varDoctor_p            = new DoctorModel();
                    varDoctor_p.EmpNo_     = item["EmpNo_"].ToString();
                    varDoctor_p.Name       = item["Name_emp"].ToString();
                    varDoctor_p.Phone      = item["Phone"].ToString();
                    varDoctor_p.CliNo_     = item["CliNo_"].ToString();
                    varDoctor_p.FacultyNo_ = item["FacultyNo_"].ToString();
                    varDoctor_p.Name_fac   = item["Name_fac"].ToString();
                    varDoctor_p.Address    = item["Address"].ToString();
                    varDoctor_p.Picture    = item["Picture"].ToString();
                    varDoctor_p.sever      = item["sever"].ToString();
                    varDoctor_p.abc        = varDoctor_p.sever + varDoctor_p.Picture;
                    listDoctor_p.Add(varDoctor_p);
                }
                MylistDoctor.ItemsSource = listDoctor_p;
            }
            catch (InvalidCastException e)
            {
                throw e;
            }
        }
        public DoctorShortViewModel MapDoctorShortModel(DoctorModel dModel)
        {
            DoctorShortViewModel viewModel = new DoctorShortViewModel();

            viewModel.Id                      = dModel.Id;
            viewModel.FirstName               = dModel.FirstName;
            viewModel.LastName                = dModel.LastName;
            viewModel.Address1                = dModel.Address1;
            viewModel.EmailAddress            = dModel.EmailAddress;
            viewModel.PhoneNumber             = dModel.PhoneNumber;
            viewModel.Pincode                 = dModel.Pincode;
            viewModel.ProfilePhotoID          = dModel.ProfilePhotoID <= 0 ? -1 : dModel.ProfilePhotoID;
            viewModel.RegistrationNumber      = dModel.RegistrationNumber;
            viewModel.CityName                = dModel.CityName;
            viewModel.StateName               = dModel.StateName;
            viewModel.CountryName             = dModel.CountryName;
            viewModel.OtherInformation        = dModel.OtherInformation;
            viewModel.DoctorDescription       = dModel.DoctorDescription;
            viewModel.DoctorCode              = dModel.DoctorCode;
            viewModel.PersonalConsultationFee = dModel.PersonalConsultationFee;
            viewModel.PhoneConsultationFee    = dModel.PhoneConsultationFee;
            viewModel.TextConsultationFee     = dModel.TextConsultationFee;
            viewModel.VideoConsultationFee    = dModel.VideoConsultationFee;
            viewModel.TanentId                = dModel.TenantID;
            viewModel.DoctorDegrees           = MapDoctorDegree(dModel.DoctorDegreeList);
            viewModel.DoctorSpecializations   = MapDoctorSpecialization(dModel.DoctorSpecialzationList);
            viewModel.DoctorHospitals         = MapDoctorHospital(dModel.DoctorHospitalList);
            viewModel.DoctorDeseases          = MapDoctorDesease(dModel.DoctorDeseaseList);
            return(viewModel);
        }
        public ActionResult ManageAccount(DoctorModel doctor)
        {
            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.UpdateDoctor(doctor);

            return(View("~/Views/Doctor/ViewAccountDetails.cshtml", model));
        }
Beispiel #17
0
        //public string obtener_nombre_doctor(string alias)
        //{
        //    string id = "";
        //    MySqlCommand cmd;
        //    string query = "select concat(nombre,' ',apellidos)as nombre_doctor from usuario where alias='" + alias + "'";
        //    try
        //    {
        //        conexionBD.Open();
        //        cmd = new MySqlCommand(query, conexionBD);
        //        string existe = cmd.ExecuteScalar().ToString();
        //        if (existe.Equals(""))
        //        {
        //            conexionBD.Close();
        //            return "";
        //        }
        //        else
        //        {
        //            reader = cmd.ExecuteReader();
        //            reader.Read();
        //            id = reader[0].ToString();
        //            conexionBD.Close();
        //            return id;

        //        }
        //    }
        //    catch (MySqlException ex)
        //    {
        //        System.Windows.Forms.MessageBox.Show("Se ha producido un error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //        conexionBD.Close();
        //        return "";
        //    }
        //}
        public DoctorModel Obtener_info_del_doctor(string alias)
        {
            DoctorModel doctor   = new DoctorModel();
            RolModel    rolModel = new RolModel();

            query = "select usuario.id_usuario,usuario.alias,usuario.nombre,usuario.apellidos,usuario.password,rol.id_rol,rol.descripcion,doctor.cedula from usuario  inner join rol on rol.id_rol=usuario.id_rol inner join doctor on usuario.id_usuario=doctor.id_usuario where usuario.alias='" + alias + "'";
            try
            {
                conexionBD.Open();
                MySqlCommand cmd = new MySqlCommand(query, conexionBD);
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    doctor.id_usuario = reader[0].ToString();
                    string aliass = reader[1].ToString();
                    string a      = aliass.Replace("_" + reader[0].ToString(), "");
                    // System.Windows.MessageBox.Show(a);
                    doctor.alias         = a;
                    doctor.nombre        = reader[2].ToString();
                    doctor.apellidos     = reader[3].ToString();
                    doctor.password      = reader[4].ToString();
                    rolModel.id_rol      = int.Parse(reader[5].ToString());
                    rolModel.descripcion = reader[6].ToString();
                    //usuarioModel.clinica = reader[12].ToString();
                    doctor.rol    = rolModel;
                    doctor.cedula = reader[7].ToString();
                }
            }
            catch (MySqlException ex)
            {
                System.Windows.MessageBox.Show(ex.ToString());
            }
            conexionBD.Close();
            return(doctor);
        }
Beispiel #18
0
        public DoctorsView()
        {
            InitializeComponent();

            isRequest = false;

            dbContext = new Clinic_DatabaseEntities();
            dbContext.Doctors.Load();

            var bindingList = dbContext.Doctors.Local.ToBindingList();

            tableModel = new ObservableCollection <DoctorModel>();

            for (int i = 0; i < bindingList.Count; i++)
            {
                DoctorModel doctorModel = new DoctorModel();

                doctorModel.Row_Number    = (i + 1);
                doctorModel.Doctor_Object = bindingList[i];

                tableModel.Add(doctorModel);
            }

            mDoctorsTable.ItemsSource = tableModel;
        }
 /// <summary>
 /// 更新医生model
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public async Task <bool> UpdateAsync(DoctorModel model)
 {
     using (var conn = MySqlHelper.GetConnection())
     {
         return((await conn.UpdateAsync(model)) > 0);
     }
 }
Beispiel #20
0
        public async Task <IActionResult> GetDoctorById([FromRoute] string id)
        {
            var findUser = await _userManager.FindByIdAsync(id);

            var findDoctor = _db.Doctors.FirstOrDefault(d => d.dr_user_id == id);

            if (findDoctor != null && findUser != null)
            {
                DoctorModel doctor = new DoctorModel();
                doctor.dr_fname        = findDoctor.dr_fname;
                doctor.dr_mname        = findDoctor.dr_mname;
                doctor.dr_lname        = findDoctor.dr_lname;
                doctor.dr_gender       = findDoctor.dr_gender;
                doctor.dr_speciality   = findDoctor.dr_speciality;
                doctor.dr_address      = findDoctor.dr_address;
                doctor.dr_about        = findDoctor.dr_about;
                doctor.dr_email        = findUser.Email;
                doctor.dr_phone        = findUser.PhoneNumber;
                doctor.dr_username     = findUser.UserName;
                doctor.dr_password     = findUser.PasswordHash;
                doctor.ConfirmPassword = findUser.PasswordHash;
                return(Ok(new JsonResult(doctor)));
            }

            else
            {
                return(NotFound());
            }
        }
Beispiel #21
0
        public async Task <IActionResult> GetDoctorsAsync()
        {
            if (_db.Doctors.Count() != 0)
            {
                List <DoctorModel> result = new List <DoctorModel>();

                var findDoctors = _db.Doctors.ToList();

                foreach (Doctor doctor in findDoctors)
                {
                    var findUser = await _userManager.FindByIdAsync(doctor.dr_user_id);

                    DoctorModel doctorModel = new DoctorModel();
                    doctorModel.dr_mname      = doctor.dr_mname;
                    doctorModel.dr_fname      = doctor.dr_fname;
                    doctorModel.dr_lname      = doctor.dr_lname;
                    doctorModel.dr_speciality = doctor.dr_speciality;
                    doctorModel.dr_about      = doctor.dr_about;
                    doctorModel.dr_address    = doctor.dr_address;
                    doctorModel.dr_gender     = doctor.dr_gender;
                    doctorModel.dr_email      = findUser.Email;
                    doctorModel.dr_phone      = findUser.PhoneNumber;
                    doctorModel.dr_username   = findUser.UserName;

                    result.Add(doctorModel);
                }

                return(Ok(result));
            }
            else
            {
                return(BadRequest(new JsonResult("No Doctors to show")));
            }
        }
Beispiel #22
0
        public void ProcessRequest(HttpContext context)
        {
            StreamReader reader    = new StreamReader(context.Request.InputStream, Encoding.UTF8);
            string       jObjStr   = reader.ReadToEnd();
            DoctorModel  userModel = JsonConvert.DeserializeObject <DoctorModel>(jObjStr);

            JObject jObj = new JObject();

            //检查用户名是否存在
            if (DoctorDAL.CheckUsernameExist(userModel.Name))
            {
                jObj.Add("state", "username exist");
            }
            else
            {
                if (DoctorDAL.Insert(userModel))
                {
                    jObj.Add("state", "success");
                }
                else
                {
                    jObj.Add("state", "failed");
                }
            }
            byte[] buf = Encoding.UTF8.GetBytes(jObj.ToString());
            context.Response.OutputStream.Write(buf, 0, buf.Length);
        }
Beispiel #23
0
        public DoctorModel GetDoctorById(int doctorId)
        {
            DoctorModel doctor   = null;
            string      sqlQuery =
                "SELECT d.*, a.first_name, a.last_name " +
                "FROM Doctor AS d " +
                "INNER JOIN Account AS a ON a.id = d.account_id " +
                "WHERE d.id = @DOCTORID";

            using (SqlConnection sqlConn = new SqlConnection(Environment.GetEnvironmentVariable("sqldb_connection")))
            {
                SqlCommand cmd = new SqlCommand(sqlQuery, sqlConn);
                cmd.Parameters.Add("@DOCTORID", SqlDbType.Int).Value = doctorId;

                sqlConn.Open();
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    try
                    {
                        doctor           = new DoctorModel();
                        doctor.DoctorId  = doctorId;
                        doctor.FirstName = reader["first_name"].ToString();
                        doctor.LastName  = reader["last_name"].ToString();
                        doctor.Location  = reader["location"].ToString();
                    }
                    catch { return(null); }
                }
            }
            return(doctor);
        }
        // GET: Doctors
        public ActionResult Index()
        {
            DoctorModel doctorModel = new DoctorModel();
            var         doctors     = doctorModel.getDoctorVms();

            return(View(doctors));
        }
Beispiel #25
0
        public ActionResult EditProfile(DoctorModel dm)
        {
            ClASDBEntities        db   = new ClASDBEntities();
            List <SelectListItem> lst1 = new List <SelectListItem>();
            var getd = db.SpecializedDatas.ToList();

            foreach (var item in getd)
            {
                lst1.Add(new SelectListItem
                {
                    Text  = item.SpecializedName,
                    Value = item.SpecializedId.ToString()
                });
            }
            int MemId   = Convert.ToInt32(Session["MemberId"]);
            var getdata = db.Doctors.FirstOrDefault(m => m.MemberId == MemId);

            getdata.FirstName       = dm.FName;
            getdata.LastName        = dm.LName;
            getdata.SpecislizeId    = dm.SpecializeId;
            getdata.TotalExperience = dm.Experience;
            getdata.Gender          = dm.Gender;



            DoctorModel dt = new DoctorModel();

            dt.ListS = lst1;
            db.SaveChanges();
            ViewBag.text = "Edited Successfully";
            return(View(dt));
        }
        private void mButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            string surname  = mFieldSurname.Text;
            string name     = mFieldName.Text;
            string lastname = mFieldLastname.Text;

            if (surname == null || surname.Equals(""))
            {
                MessageBox.Show("Укажите фамилию!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else if (name == null || name.Equals(""))
            {
                MessageBox.Show("Укажите имя!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            DoctorModel doctorModel = new DoctorModel();

            doctorModel.Row_Number = tableModel.Count + 1;

            doctorModel.Doctor_Object          = new Doctor();
            doctorModel.Doctor_Object.Surname  = surname;
            doctorModel.Doctor_Object.Name     = name;
            doctorModel.Doctor_Object.Lastname = lastname;

            dbContext.Doctors.Add(doctorModel.Doctor_Object);
            dbContext.SaveChanges();

            tableModel.Add(doctorModel);

            mFieldSurname.Text  = "";
            mFieldName.Text     = "";
            mFieldLastname.Text = "";
        }
Beispiel #27
0
        public ActionResult ShowDoctor(DoctorModel doctor)
        {
            ViewBag.specialization = doctorManager.GetSpecialization();
            ViewBag.doctorList     = doctorManager.GetAllDoctor(doctor.Specilization);

            return(View());
        }
Beispiel #28
0
        public ActionResult Edit(int id)
        {
            MembershipUser _getCurrentUser = Membership.GetUser();
            DoctorModel    _getmodel       = new DoctorModel();

            if (_getCurrentUser != null)
            {
                bool IsRole = Roles.IsUserInRole("Admin");
                if (IsRole)
                {
                    Guid         _adminkey = (Guid)_getCurrentUser.ProviderUserKey;
                    DoctorManage _profile  = DoctorManage.EditUser(id, _adminkey);
                    if (_profile != null)
                    {
                        _getmodel.UserName    = _profile.UserName;
                        _getmodel.Email       = _profile.Email;
                        _getmodel.Name        = _profile.Name;
                        _getmodel.PhoneNumber = _profile.PhoneNumber;
                        _getmodel.DDOB        = _profile.DDOB;
                        _getmodel.Address1    = _profile.Address1;
                        _getmodel.Address2    = _profile.Address2;
                        _getmodel.Practice    = _profile.Practice;
                    }

                    return(View(_getmodel));
                }
            }

            return(RedirectToAction("Index", "Patient"));
        }
        public IEnumerable <ReportModel> GetReportsByDoctor(DoctorModel doctor)
        {
            IEnumerable <ReportModel> result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(Utils.Url());
                    client.DefaultRequestHeaders.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    var jsonData    = JsonConvert.SerializeObject(doctor);
                    var buffer      = System.Text.Encoding.UTF8.GetBytes(jsonData);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                    HttpResponseMessage Res = client.GetAsync(Utils.Url() + "Report/GetReportsByDoctor").Result;

                    if (Res.IsSuccessStatusCode)
                    {
                        var res = (Res.Content.ReadAsAsync <IEnumerable <ReportModel> >().Result);

                        result = res;
                        Utils.Logging(Environment.StackTrace, null);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                Utils.Logging(ex, 2);
                return(result);
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Speciality")] DoctorModel doctorModel)
        {
            if (id != doctorModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    cntx.Update(doctorModel);
                    await cntx.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorModelExists(doctorModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctorModel));
        }
        public ActionResult UpdateAvatar(DoctorIndex post)
        {
            resetViewBagMessages();
            HttpPostedFileBase ImageUrl = Request.Files[0];

            if (ImageUrl != null && ImageUrl.ContentLength > 0)
            {
                var fileName = Path.GetFileName(ImageUrl.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/images/avatar/"), fileName);
                ImageUrl.SaveAs(path);

                DoctorModel doctor = DataBase.Session.Load <DoctorModel>(post.Doctor.ID);
                //delete Previous file
                if (System.IO.File.Exists(doctor.Image_url))
                {
                    System.IO.File.Delete(doctor.Image_url);
                }
                //updating new file
                doctor.Image_url  = path;
                doctor.Image_name = fileName;
                DataBase.Session.Update(doctor);
                Session["DOCAVATAR"] = fileName;
                if (System.IO.File.Exists(path))
                {
                    message = "Avatar Sucessfully Updated";
                }
            }
            else
            {
                err = "Error Occured while updating Avatar";
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult EditProfile()
        {
            using (var db = new MainDbContext())
            {
                string firstname = User.Identity.Name;
                var DocModel = db.Doctor.FirstOrDefault(u => u.FirstName.Equals(firstname));

                var searchKeyAdd = db.Doctor.Select(u => u.Key_Address);
                var materializeAddKey = searchKeyAdd.ToList();
                var KeyAdd = materializeAddKey[0];
                var AddModel = db.Address.FirstOrDefault(u => u.Id.Equals(KeyAdd));

                var searchKeyCon = db.Doctor.Select(u => u.Key_Contact);
                var materializeConKey = searchKeyCon.ToList();
                var KeyCon = materializeConKey[0];
                var ConModel = db.Contact.FirstOrDefault(u => u.Id.Equals(KeyCon));

                var searchUserKey = db.Doctor.Select(u => u.Key_Users);
                var materializeUserKey = searchUserKey.ToList();
                var KeyUser = materializeUserKey[0];
                var UsersModel = db.Users.FirstOrDefault(u => u.Id.Equals(KeyUser));

                var password = CustomDecrypt.Decrypt(UsersModel.Password);

                UsersModel.Password = password;

                var viewmodel = new DoctorModel {
                                    Contact = ConModel,
                                    Address = AddModel,
                                    Doctor = DocModel,

                                    Users = UsersModel
                                    };

                return View(viewmodel);
            }
        }
Beispiel #33
0
 public ActionResult EditProfile()
 {
     var doctor = _doctorService.GetDoctor(User.Identity.Name);
     var model = new DoctorModel();
     model.FirstName = doctor.FirstName;
     model.LastName = doctor.LastName;
     model.Specialization = doctor.Specialization;
     model.Gender = doctor.Gender;
     model.MobileNumber = doctor.MobileNumber;
     model.Age = doctor.Age;
     var address = _doctorService.GetAddress(User.Identity.Name);
     if (address != null)
     {
         model.HouseNo = address.HouseNo;
         model.RoadNo = address.RoadNo;
         model.Thana = address.Thana;
         model.Zilla = address.Zilla;
     }
     return View(model);
 }
        public ActionResult EditProfile(DoctorModel model)
        {
            if (ModelState.IsValid)
            {
                using (var db = new MainDbContext())
                {

                    string firstname = User.Identity.Name;

                    //Get Doctor
                    var DocModel = db.Doctor.FirstOrDefault(u => u.FirstName.Equals(firstname));
                    DocModel.HospName = model.Doctor.HospName;
                    DocModel.EmployeeId = model.Doctor.EmployeeId;
                    DocModel.LicenseNo = model.Doctor.LicenseNo;
                    DocModel.Specialization = model.Doctor.Specialization;
                    DocModel.FirstName = model.Doctor.FirstName;
                    DocModel.MiddleName = model.Doctor.MiddleName;
                    DocModel.LastName = model.Doctor.LastName;
                    DocModel.Email = model.Doctor.Email;
                    DocModel.DateBirth = model.Doctor.DateBirth;
                    DocModel.Sex = model.Doctor.Sex;
                    DocModel.SecQuestion = model.Doctor.SecQuestion;
                    DocModel.SecAnswer = model.Doctor.SecAnswer;

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

                    // Get the Address
                    var searchKeyAdd = db.Doctor.Select(u => u.Key_Address);
                    var materializeAddKey = searchKeyAdd.ToList();
                    var KeyAdd = materializeAddKey[0];
                    var AddModel = db.Address.FirstOrDefault(u => u.Id.Equals(KeyAdd));

                    AddModel.City = model.Address.City;
                    AddModel.Province = model.Address.Province;
                    AddModel.Zipcode = model.Address.Zipcode;
                    AddModel.AddressType = model.Address.AddressType;

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

                    // Get the Contact
                    var searchKeyCon = db.Doctor.Select(u => u.Key_Contact);
                    var materializeConKey = searchKeyCon.ToList();
                    var KeyCon = materializeConKey[0];
                    var ConModel = db.Contact.FirstOrDefault(u => u.Id.Equals(KeyCon));

                    ConModel.MobileNo = model.Contact.MobileNo;
                    ConModel.PhoneNo = model.Contact.PhoneNo;

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

                    // Get the Users
                    var searchUserKey = db.Doctor.Select(u => u.Key_Users);
                    var materializeUserKey = searchUserKey.ToList();
                    var KeyUser = materializeUserKey[0];
                    var UsersModel = db.Users.FirstOrDefault(u => u.Id.Equals(KeyUser));

                    var encryptedPassword = CustomEnrypt.Encrypt(model.Users.Password);
                    UsersModel.Username = model.Users.Username;
                    UsersModel.Password = encryptedPassword;

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

                    db.SaveChanges();

                    var identity = new ClaimsIdentity(new[] {
                           new Claim(ClaimTypes.Name, DocModel.FirstName),
                           new Claim(ClaimTypes.Role, "doctor")
                           }, "ApplicationCookie");

                    var ctx = Request.GetOwinContext();

                    var authManager = ctx.Authentication;

                    authManager.SignIn(identity);

                    return RedirectToAction("Index", "Doctor");
                }

            }

            return View(model);
        }
        public ActionResult CreateDoctor(DoctorModel model)
        {
            if(ModelState.IsValid)
            {
                using (var db = new MainDbContext())
                {
                    var queryUser = db.Users.FirstOrDefault(u => u.Username == model.Users.Username);
                    if (queryUser == null)
                    {
                            var encryptedPassword = CustomEnrypt.Encrypt(model.Users.Password);

                            var doctor = db.Doctor.Create();
                            var address = db.Address.Create();
                            var contact = db.Contact.Create();
                            var user = db.Users.Create();
                            var role = db.Role.Create();
                            doctor.FirstName = model.Doctor.FirstName;
                            doctor.MiddleName = model.Doctor.MiddleName;
                            doctor.LastName = model.Doctor.LastName;
                            doctor.Email = model.Doctor.Email;
                            doctor.DateBirth = model.Doctor.DateBirth;
                            doctor.Sex = model.Doctor.Sex;
                            doctor.SecQuestion = model.Doctor.SecQuestion;
                            doctor.SecAnswer = model.Doctor.SecAnswer;
                            doctor.EmployeeId = model.Doctor.EmployeeId;
                            doctor.LicenseNo = model.Doctor.LicenseNo;
                            doctor.HospName = model.Doctor.HospName;
                            doctor.Specialization = model.Doctor.Specialization;
                            address.AddressType = model.Address.AddressType;
                            address.City = model.Address.City;
                            address.Province = model.Address.Province;
                            address.Zipcode = model.Address.Zipcode;
                            user.Username = model.Users.Username;
                            user.Password = encryptedPassword;
                            user.Password = encryptedPassword;
                            role.RoleType = "doctor";
                            contact.MobileNo = model.Contact.MobileNo;
                            contact.PhoneNo = model.Contact.PhoneNo;

                            db.Address.Add(address);
                            db.Contact.Add(contact);
                            db.Role.Add(role);
                            db.SaveChanges();

                            user.Key_Role = role.Id;
                            db.Users.Add(user);
                            db.SaveChanges();

                            doctor.Key_Users = user.Id;
                            doctor.Key_Address = address.Id;
                            doctor.Key_Contact = contact.Id;
                            db.Doctor.Add(doctor);
                            db.SaveChanges();

                            return RedirectToAction("CreateDoctor", "Admin");
                        }
                        else
                        {
                            return RedirectToAction("CreateDoctor", "Admin");
                        }
                    }
                }
            else
            {
                 ModelState.AddModelError("", "One or more fields have been");
            }
            return View();
        }