Exemplo n.º 1
0
    /*
    void BindDepartment()
    {
        Doctors o = new Doctors();
        DepartmentList.DataSource = o.getDepartment();
        DepartmentList.DataTextField = "ShortName";
        DepartmentList.DataValueField = "Id";
        DepartmentList.DataBind();
        DepartmentList.Items.Insert(0, "Select");
    }

    void BindCity()
    {
        Doctors o = new Doctors();
        CityList.DataSource = o.getDepartment();
        CityList.DataTextField = "ShortName";
        CityList.DataValueField = "Id";
        CityList.DataBind();
        CityList.Items.Insert(0, "Select");
    }

    void BindArea()
    {
        Doctors o = new Doctors();
        AreaList.DataSource = o.getDepartment();
        AreaList.DataTextField = "ShortName";
        AreaList.DataValueField = "Id";
        AreaList.DataBind();
        AreaList.Items.Insert(0, "Select");
    }
    */
    protected void LoginButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            AMADBasePage bp = new AMADBasePage();
            DataSet ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    LoginNameLabel.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
                    LastLoginTimeLabel.Text = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                    postLoginDiv.Style["display"] = "block";
                    Session["UserData"] = ds.Tables[0];
                    if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                    {
                        Doctors doc = new Doctors();
                        DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                        if (dsDoc == null)
                            Response.Redirect("UnAuthorizedAccess.aspx");
                        else
                        {
                            Session["DoctorData"] = dsDoc.Tables[0];
                            Response.Redirect("ManageSchedule.aspx");
                        }
                    }
                    else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                        Response.Redirect("BookAppointment.aspx");
                    else
                        Response.Redirect("BookAppointment.aspx");
                }
                else
                {
                    Session["UserData"] = null;
                    LoginNameLabel.Text = "";
                    LastLoginTimeLabel.Text = "";
                    postLoginDiv.Style["display"] = "none";
                    Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                }
            }
            else
            {
                LoginNameLabel.Text = "";
                LastLoginTimeLabel.Text = "";
                postLoginDiv.Style["display"] = "none";
            }

        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "enable2", "openLoginModal();", true);
        }
    }
Exemplo n.º 2
0
 protected void LoginButton_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             AMADBasePage bp = new AMADBasePage();
             DataSet ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
             if (ds.Tables.Count > 0)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Session["LoginName"] = ds.Tables[0].Rows[0]["FirstName"].ToString();
                     Session["LastLoginTime"] = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                     Session["UserData"] = ds.Tables[0];
                     if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                     {
                         Doctors doc = new Doctors();
                         DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                         if (dsDoc == null)
                             Response.Redirect("UnAuthorizedAccess.aspx");
                         else
                         {
                             Session["DoctorData"] = dsDoc.Tables[0];
                             Response.Redirect("ManageSchedule.aspx");
                         }
                     }
                     else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                         Response.Redirect("BookAppointment.aspx");
                 }
                 else
                 {
                     Session["LoginName"] = null;
                     Session["LastLoginTime"] = null;
                     Session["UserData"] = null;
                     RegisterLabel.Text = "Username and/or password is invalid.";
                     //Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                 }
             }
             else
             {
                 Session["LoginName"] = null;
                 Session["LastLoginTime"] = null;
                 Session["UserData"] = null;
                 RegisterLabel.Text = "Username and/or password is invalid.";
             }
         }
         catch(Exception ex)
         {
         }
     }
 }
Exemplo n.º 3
0
 void BindDepartment()
 {
     Doctors o = new Doctors();
     DataSet ds = o.getDepartment();
     DepartmentList.DataSource = ds;
     DepartmentList.DataTextField = "ShortName";
     DepartmentList.DataValueField = "Id";
     DepartmentList.DataBind();
     DepartmentList.Items.Insert(0, "Select");
     foreach (ListItem _listItem in this.DepartmentList.Items)
     {
         _listItem.Attributes.Add("title", _listItem.Text);
     }
 }
Exemplo n.º 4
0
    void BindCityAndArea()
    {
        Doctors o = new Doctors();
        DataSet ds = o.GetCitiesAndAreas();
        DataView dvCities = new DataView(ds.Tables[0]);
        DataView dvAreas = new DataView(ds.Tables[0]);
        //dvCities.RowFilter = " Distinct City";
        CityList.DataSource = dvCities.ToTable();
        CityList.DataTextField = "City";
        CityList.DataValueField = "City";
        CityList.DataBind();
        CityList.Items.Insert(0, "Select");

        AreaList.DataSource = ds;
        AreaList.DataTextField = "LocationName";
        AreaList.DataValueField = "LocationId";
        AreaList.DataBind();
        AreaList.Items.Insert(0, "Select");

        HospitalCityList.DataSource = dvCities.ToTable();
        HospitalCityList.DataTextField = "City";
        HospitalCityList.DataValueField = "City";
        HospitalCityList.DataBind();
        HospitalCityList.Items.Insert(0, "Select");

        HospitalAreaList.DataSource = ds;
        HospitalAreaList.DataTextField = "LocationName";
        HospitalAreaList.DataValueField = "LocationId";
        HospitalAreaList.DataBind();
        HospitalAreaList.Items.Insert(0, "Select");

        HospitalList.Items.Insert(0, "Select");

        LabCityList.DataSource = dvCities.ToTable();
        LabCityList.DataTextField = "City";
        LabCityList.DataValueField = "City";
        LabCityList.DataBind();
        LabCityList.Items.Insert(0, "Select");

        LabAreaList.DataSource = ds;
        LabAreaList.DataTextField = "LocationName";
        LabAreaList.DataValueField = "LocationId";
        LabAreaList.DataBind();
        LabAreaList.Items.Insert(0, "Select");
    }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Cookies[ConstantKeys.DoctorSearchInfo] != null)
         {
             string dept = Server.HtmlEncode(Request.Cookies[ConstantKeys.DoctorSearchInfo][ConstantKeys.SearchDepartment]);
             string city = Server.HtmlEncode(Request.Cookies[ConstantKeys.DoctorSearchInfo][ConstantKeys.SearchCity]);
             string area = Server.HtmlEncode(Request.Cookies[ConstantKeys.DoctorSearchInfo][ConstantKeys.SearchArea]);
             DepartmentLabel.Text = "<b style='color:#D8322C'>" + dept + "</b>" + " in <b style='color:#D8322C'>" + area + "</b>, <b style='color:#D8322C'>" + city + "</b>";
             Doctors dc = new Doctors();
             dsSchedule = dc.GetDoctorsListForAppointment(dept, city, area);
             //GAuthenticate();
             dataListDoctors.DataSource = dsSchedule.Tables[0];
             dataListDoctors.DataBind();
         }
     }
 }
Exemplo n.º 6
0
    protected void SubmitButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (ValidateScheduleDates() && ValidateSchedule())
                {
                    Doctors objDoc = new Doctors();
                    objDoc.ScheduleType = ScheduleTypeRadio.SelectedItem.Value;
                    DateTime fmDt = Convert.ToDateTime(ScheduleFromTextBox.Text);
                    DateTime toDt = Convert.ToDateTime(ScheduleToDateTextBox.Text);
                    objDoc.ScheduleFromDate = fmDt.AddHours(double.Parse(AvailableFrom.SelectedItem.Text));
                    objDoc.ScheduleToDate = toDt.AddHours(double.Parse(AvailableTo.SelectedItem.Text)).AddMinutes(59).AddSeconds(59);
                    objDoc.AvailableFrom = AvailableFrom.SelectedItem.Text + ":00";
                    objDoc.AvailableTo = AvailableTo.SelectedItem.Text + ":00";
                    objDoc.DoctorId = 1;
                    objDoc.DoctorCode = DoctorCodeLabel.Text;

                    int result = objDoc.CreateDoctorsSchedule();

                    switch (result)
                    {
                        case 0:
                            RegisterLabel.Text = "Invalid entry, kindly verify the details and try again !!!";
                            break;
                        case 1:
                            RegisterLabel.Text = "Your schedule has been saved successfully. You can view your saved schedule in below table. !!!";
                            break;
                        case 2:
                            RegisterLabel.Text = "Your schedule cannot be saved. It overlaps with existing schedule. !!!";
                            break;
                    }
                }
            }
            catch(Exception ex)
            {
            }
        }
        BindDoctorSchedule();
    }
Exemplo n.º 7
0
        /// <summary>
        /// Accepts Doctors object, delete row(s) from Doctors table
        ///
        /// return docID of deleted row(s)
        /// </summary>
        /// <param name="Doctors">Doctors object</param>
        /// <param name="sqlCmd">SqlCommand object</param>
        /// <returns>docID of deleted row(s)</returns>
        public static int Delete(Doctors objDoctors, SqlCommand sqlCmd)
        {
            // Validating provided SqlCommand
            if (sqlCmd.Connection == null || sqlCmd.Connection.State == ConnectionState.Closed)
            {
                throw new Exception("Error in provided Connection. Please set SqlCommand.Connection = new SqlConnection(string ConnectionString); or in other ways.");
            }
            if (sqlCmd.Transaction == null)
            {
                throw new Exception("Error in provided SqlTransaction. Please set sqlCmd.Transaction = sqlCmd.Connection.BeginTransaction(); or in other ways.");
            }

            objDoctors.Validate(SqlOperation.Delete);
            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.CommandText = Doctors_Delete;
            sqlCmd             = AttachParameters(sqlCmd, objDoctors, SqlOperation.Delete);

            try
            {
                int retval = (int)SqlHelper.ExecuteNonQuery(sqlCmd);
                return(objDoctors.docID);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 8
0
        public async ValueTask <bool> AddNewVisitorAsync(int doctorId, Visitation visitor)
        {
            try
            {
                var doc = await Doctors
                          .Where(d => d.DoctorId == doctorId)
                          .FirstOrDefaultAsync();

                if (doc == null)
                {
                    return(false);
                }

                doc.VisitationList.Add(visitor);

                await SaveChangesAsync();
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 9
0
        private void loginDoctors_Click(object sender, EventArgs e)
        {
            var user     = idCardLogin.Text;
            var password = passwordDoctor.Text;
            Dictionary <string, object> queryDict = new Dictionary <string, object>();

            queryDict.Add("ID_Kartice", user);
            queryDict.Add("Sifra", password);

            var query = new Neo4jClient.Cypher.CypherQuery("start n=node(*) where (n:Doctors) and exists(n.ID_Kartice) and n.ID_Kartice =~ {ID_Kartice} and n.Sifra =~ {Sifra} return n",
                                                           queryDict, CypherResultMode.Set);

            Doctors doc = ((IRawGraphClient)client).ExecuteGetCypherResults <Doctors>(query).SingleOrDefault();

            if (doc != null)
            {
                Doktors d = new Doktors(doc);
                d.ShowDialog();
            }
            else
            {
                MessageBox.Show("Pogresni Kredencijali!");
            }
        }
Exemplo n.º 10
0
        public void AddUser(PersonEditDomainView personEditDomainView, UserEditDomainView userEditDomainView, int id)
        {
            Persons newpersons = new Persons()
            {
                FirstName   = personEditDomainView.FirstName,
                MiddleName  = personEditDomainView.MiddleName,
                LastName    = personEditDomainView.LastName,
                Age         = personEditDomainView.Age,
                HomeAddress = personEditDomainView.HomeAddress,
                Phone       = personEditDomainView.Phone,
                ImageUrl    = personEditDomainView.ImageUrl
            };

            newpersons = _context.Persons.Add(newpersons).Entity;
            Save();
            Users newuser = new Users()
            {
                UserName     = userEditDomainView.UserName,
                UserPassword = userEditDomainView.UserPassword,
                IsActive     = true,
                RoleId       = userEditDomainView.RoleId,
                PersonId     = newpersons.Id
            };

            Insert(newuser);
            if (userEditDomainView.RoleId == (int)EnumRole.Doctor)
            {
                Doctors newdoctor = new Doctors()
                {
                    PersonId         = newpersons.Id,
                    SpecializationId = id
                };
                _context.Doctors.Add(newdoctor);
            }
            Save();
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            string  webRootPath = _hostingEnvironment.WebRootPath;
            Doctors products    = await _db.Doctors.FindAsync(id);

            if (products == null)
            {
                return(NotFound());
            }
            else
            {
                var uploads   = Path.Combine(webRootPath, SD.ImageFolder);
                var extension = Path.GetExtension(products.Image);

                if (System.IO.File.Exists(Path.Combine(uploads, products.Id + extension)))
                {
                    System.IO.File.Delete(Path.Combine(uploads, products.Id + extension));
                }
                _db.Doctors.Remove(products);
                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
        }
Exemplo n.º 12
0
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            string docID = txtDoctorID.Text;
            string LName = txtLastName.Text;
            string FName = txtFirstName.Text;
            string sPec  = cboSpecialty.Text;
            string sMsg  = "";

            Doctors oDoctors = new Doctors();

            try
            {
                sMsg = oDoctors.UpdateData(docID, LName, FName, sPec);
            }
            catch
            {
                sMsg = "Error saving data." + "\n\n" + e.ToString();
            }
            finally
            {
                sMsg = "Doctors record has been updated.\n\n";
                MessageBox.Show(sMsg, "Update Record", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 13
0
        private void btnFind_Click(object sender, System.EventArgs e)
        {
            string docID = txtDoctorID.Text;
            string sMsg  = "";

            DataSet o_Find   = new DataSet();
            Doctors oDoctors = new Doctors();

            try
            {
                o_Find = oDoctors.FindData(docID);
                dgDoctors.DataSource = o_Find.Tables[0];
                sMsg = "Doctor record found.";
            }
            catch
            {
                sMsg             = "Doctor not in database.";
                txtDoctorID.Text = "";
            }
            finally
            {
                MessageBox.Show(sMsg, "Find Record", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 14
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            string docID = txtDoctorID.Text;
            string LName = txtLastName.Text;
            string FName = txtFirstName.Text;
            string sPec  = cboSpecialty.SelectedItem.ToString();
            string sMsg  = "";

            DataSet o_Add    = new DataSet();
            Doctors oDoctors = new Doctors();

            try
            {
                sMsg = oDoctors.AddData(docID, LName, FName, sPec);
            }
            catch
            {
                sMsg = "Error saving data." + "\n\n" + e.ToString();
            }
            finally
            {
                MessageBox.Show(sMsg, "Add Record", MessageBoxButtons.OK);
            }
        }
        public string SaveDoctor(Doctors aDoctors)
        {
            bool isDoctorExistInSameMedical = aMedicalGateway.IsDoctorExistInCurrentMedical(aDoctors.MobileNo, aDoctors.BmdcReg, aDoctors.MedicalId);

            if (isDoctorExistInSameMedical)
            {
                return("This doctor already exists in your medical.");
            }
            else
            {
                bool isDoctorExistInOtherMedical = aMedicalGateway.IsDoctorExistInOtherMedical(aDoctors.MobileNo, aDoctors.BmdcReg, aDoctors.MedicalId);
                if (isDoctorExistInOtherMedical)
                {
                    return("Exist");
                }
                else
                {
                    if (aUserGateway.IsMobileNoExists(aDoctors.MobileNo) == false && aDoctorGateway.IsDoctorExists(aDoctors.MobileNo, aDoctors.BmdcReg) == false)
                    {
                        bool rowAffected = aMedicalGateway.SaveDoctor(aDoctors);
                        if (rowAffected)
                        {
                            return("Success");
                        }
                        else
                        {
                            return("Doctor assigning failed.");
                        }
                    }
                    else
                    {
                        return("Exist");
                    }
                }
            }
        }
Exemplo n.º 16
0
        public ActionResult New(
            [Bind(Exclude = "IsEmailVerified,ActivationCode")]
            Doctors doctors)
        {
            bool   Status  = false;
            string Message = null;

            var ViewModel = new DoctorView {
                Doctors = new Doctors(), Departments = _contex.Departments.ToList(),
            };

            if (!ModelState.IsValid)
            {
                Message = "Invalid Request";
                return(this.View("New", ViewModel));
            }
            else
            {
                if (doctors.Id == 0)
                {
                    if (this.IsEmailExist(doctors.DoctorEmail))
                    {
                        this.ModelState.AddModelError("EmailExist", "Email is already exist");
                        return(this.View("New", ViewModel));
                    }

                    #region Generate Activation Code

                    doctors.ActivationCode = Guid.NewGuid();

                    #endregion

                    #region Password Hashing

                    doctors.DoctorPassword        = Crypto.Hash(doctors.DoctorPassword);
                    doctors.DoctorConfirmPassword = Crypto.Hash(doctors.DoctorConfirmPassword);

                    #endregion

                    doctors.IsEmailVarified = false;

                    #region Image file upload

                    string fileName = Path.GetFileName(doctors.DoctorImagefile.FileName);
                    doctors.DoctorImagePath = "/Image/doctors/" + fileName;
                    fileName = Path.Combine(Server.MapPath("~/Image/doctors/"), fileName);

                    #endregion

                    #region Save Data

                    doctors.DoctorImagefile.SaveAs(fileName);
                    this._contex.Doctorses.Add(doctors);
                    this._contex.SaveChanges();

                    #endregion

                    #region Send Email

                    var url        = "/Doctor/VarifyAccount/" + doctors.ActivationCode.ToString();
                    var requestUrl = this.Request.Url;
                    if (requestUrl != null)
                    {
                        string link = requestUrl.AbsoluteUri.Replace(requestUrl.PathAndQuery, url);
                        Email.SendVarificationEmail(doctors.DoctorEmail, link);
                    }

                    Message = "Registration successfully done, Check your Email";
                    Status  = true;

                    this.ViewBag.Message = Message;
                    this.ViewBag.Status  = true;

                    #endregion
                }
                else
                {
                    var doctorInDb = this._contex.Doctorses.Single(d => d.Id == doctors.Id);
                    doctorInDb.DoctorName      = doctors.DoctorName;
                    doctorInDb.DoctorBirthDate = doctors.DoctorBirthDate;
                    doctorInDb.DepartmentId    = doctors.DepartmentId;
                    this._contex.SaveChanges();
                }

                return(View("New", ViewModel));
            }

            this.ViewBag.Message = Message;
            this.ViewBag.Status  = Status;

            return(this.View());
        }
Exemplo n.º 17
0
        public void login(User user, string pwd)
        {
            MessageBox.Show("1");
            //User user = new User();
            if (pwd == user.Password)
            {
                switch (user.Acctype)
                {
                case "Doctor":
                    FormHomePage hpg = new FormHomePage();
                    hpg.Hide();
                    Doctors dctr = new Doctors();
                    getdatafrmdctrs(dctr, user.Userid);
                    View.FormDoctoracc FDA = new View.FormDoctoracc();
                    FDA.set_values(user, dctr);



                    FDA.Show();
                    break;

                case "MLT":
                    FormHomePage hpg2 = new FormHomePage();
                    hpg2.Hide();

                    View.Formtechacc FTA = new View.Formtechacc();
                    FTA.Show();


                    break;

                case "Radiologist":
                    FormHomePage hpg3 = new FormHomePage();
                    hpg3.Hide();

                    View.Formtechacc FTAr = new View.Formtechacc();
                    FTAr.Show();

                    break;

                case "Nurse":
                    FormHomePage hpg4 = new FormHomePage();
                    hpg4.Hide();

                    View.Formtechacc FTAn = new View.Formtechacc();
                    FTAn.Show();

                    break;

                case "Physiotherapist":
                    FormHomePage hpg5 = new FormHomePage();
                    hpg5.Hide();

                    View.Formtechacc FTAp = new View.Formtechacc();
                    FTAp.Show();

                    break;

                case "Patient":
                    FormHomePage hpg6 = new FormHomePage();
                    hpg6.Hide();

                    View.FormPatient FPA = new View.FormPatient();
                    FPA.Show();
                    break;

                case "Pharmacist":

                    break;
                }
            }
            else
            {
                MessageBox.Show("wrong password");
                MessageBox.Show(user.Password);
            }
        }
Exemplo n.º 18
0
        public async Task CreateNewUser(Doctors doctor)
        {
            await _context.Doctors.AddAsync(doctor);

            await _context.SaveChangesAsync();
        }
Exemplo n.º 19
0
        private static void CreateJson(Model model)
        {
            if (model.GetType() == typeof(Doctor))
            {
                var list = JsonConvert.DeserializeObject <List <Doctor> >(File.ReadAllText($@"{SaveLocation}\Doctor.json"));
                Doctors = list ?? new List <Doctor>();
                Doctors.Add((Doctor)model);

                var convertedJson = JsonConvert.SerializeObject(Doctors, Formatting.Indented);

                File.WriteAllText($@"{SaveLocation}\Doctor.json", convertedJson);
            }
            else if (model.GetType() == typeof(Patient))
            {
                var list = JsonConvert.DeserializeObject <List <Doctor> >(File.ReadAllText($@"{SaveLocation}\Doctor.json"));
                Doctors = list ?? new List <Doctor>();

                foreach (var doctor in Doctors)
                {
                    // Search current logged in doctor
                    if (doctor.Username != Doctor.Username)
                    {
                        continue;
                    }

                    if (doctor.Patients == null)
                    {
                        doctor.Patients = new List <Patient>();
                    }

                    // Search if patient already exists
                    foreach (var patient in doctor.Patients)
                    {
                        if (patient.Key == ((Patient)model).Key)
                        {
                            throw new PatientAlreadyExistsExcepetion();
                        }
                    }

                    // Add then
                    doctor.Patients.Add((Patient)model);
                }

                var convertedJson = JsonConvert.SerializeObject(Doctors, Formatting.Indented);

                File.WriteAllText($@"{SaveLocation}\Doctor.json", convertedJson);
            }
            else if (model.GetType() == typeof(HealthInsurance))
            {
                var list = JsonConvert.DeserializeObject <List <HealthInsurance> >(File.ReadAllText($@"{SaveLocation}\HealthInsurances.json"));
                HealthInsurances = list ?? new List <HealthInsurance>();
                HealthInsurances.Add((HealthInsurance)model);

                var convertedJson = JsonConvert.SerializeObject(HealthInsurances, Formatting.Indented);

                File.WriteAllText($@"{SaveLocation}\HealthInsurances.json", convertedJson);
            }
            var json = JsonConvert.SerializeObject(model);

            Console.WriteLine(json);
        }
Exemplo n.º 20
0
 public void updateDoctor(Doctors update)
 {
     Context.Doctors.Update(update);
     Context.SaveChanges();
 }
 public IActionResult OnGet(int id)
 {
     Doctors = _doctorsRepository.GetById(id);
     _doctorsRepository.Delete(Doctors);
     return(RedirectToPage("./Doctores"));
 }
        public ActionResult Login(Login aLogin, string returnUrl = "")
        {
            if (ModelState.IsValid)
            {
                aLogin.Password = Crypto.Hash(aLogin.Password);
                //Check User Login
                if (aUserManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                    var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                    string encrypted = FormsAuthentication.Encrypt(ticket);
                    var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                    cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                    cookie.HttpOnly = true;
                    Response.Cookies.Add(cookie);

                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "User"));
                    }
                }
                //Check Doctor Login
                else if (aDoctorManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    Doctors doctor = aDoctorManager.IsLoginVerified(aLogin.LoginId);
                    if (doctor.PasswordVerified)
                    {
                        if (doctor.Status == "Active")
                        {
                            int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                            var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                            string encrypted = FormsAuthentication.Encrypt(ticket);
                            var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                            cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                            cookie.HttpOnly = true;
                            Response.Cookies.Add(cookie);

                            if (Url.IsLocalUrl(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Doctor"));
                            }
                        }
                        else
                        {
                            ViewBag.AccountWarningMessage = "Your account has been suspended. Please contact us to activate your account.";
                        }
                    }
                    else
                    {
                        TempData["WarningMessage"] = "Please change your temporary password";
                        ChangePassword aChangePassword = new ChangePassword();
                        aChangePassword.DoctorLoginId = aLogin.LoginId;
                        aChangePassword.OldPassword   = aLogin.Password;
                        Session["UserLoginId"]        = aChangePassword;
                        return(RedirectToAction("ChangeTemporaryPassword", "Register"));
                    }
                }
                //Check Medical Login
                else if (aMedicalManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    MedicalAccount medicalAccount = aMedicalManager.IsMedicalLoginVerified(aLogin.LoginId);
                    if (medicalAccount.IsEmailVerified)
                    {
                        if (medicalAccount.Status == "Active")
                        {
                            int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                            var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                            string encrypted = FormsAuthentication.Encrypt(ticket);
                            var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                            cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                            cookie.HttpOnly = true;
                            Response.Cookies.Add(cookie);

                            if (Url.IsLocalUrl(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Medical"));
                            }
                        }
                        else if (medicalAccount.Status == "Pending")
                        {
                            ViewBag.AccountWarningMessage = "This account request is pending. Please contact us if you want to activate.";
                        }
                        else
                        {
                            ViewBag.AccountWarningMessage = "This account has been suspended. Please contact us to activate the account.";
                        }
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Your email has not verified yet. Please check your email and verified your account";
                    }
                }
                else
                {
                    ViewBag.ErrorMessage = "Your Email or Password is incorrect!";
                }
            }
            return(View());
        }
 public int Update(Doctors doctor)
 {
     return(dGateway.Update(doctor));
 }
Exemplo n.º 24
0
 internal int addDoctor(Doctors drs)
 {
     String sql = "insert into DR   (firstname,lastname,mi,email,clinic,speciality ) values(:f,:l,:m,:e,:c,:s)";
     int data = db.Database.ExecuteSqlCommand(sql,
                    new OracleParameter(":f", drs.FirstName),
                    new OracleParameter(":l", drs.LastName),
                    new OracleParameter(":m", drs.Mi),
                    new OracleParameter(":e", drs.Email),
                    new OracleParameter(":c", drs.Clinic),
                    new OracleParameter(":s", drs.Speciality)
                    );
     return data;
 }
Exemplo n.º 25
0
 internal void updateDoctor(Doctors doctorItem)
 {
     String sql = "update DR set firstname=:fn,lastname=:ln,mi=:m ,email=:e,clinic=:c,speciality=:s,active=:a where id=:y";
     using (MedMidsContext db = new MedMidsContext())
     {
         db.Database.ExecuteSqlCommand(sql, new OracleParameter(":fn", doctorItem.FirstName),
                                            new OracleParameter(":lv", doctorItem.LastName),
                                            new OracleParameter(":m", doctorItem.Mi),
                                            new OracleParameter(":e", doctorItem.Email),
                                            new OracleParameter(":c", doctorItem.Clinic),
                                            new OracleParameter(":s", doctorItem.Speciality),
                                            new OracleParameter(":a", doctorItem.Active),
                                            new OracleParameter(":y", doctorItem.Id));
     }
 }
 public AddDoctorViewModel()
 {
     TheSelectedDoctor = new Doctors();
 }
Exemplo n.º 27
0
 public Doctor GetDoctorDetails(int id)
 {
     return(Doctors.Where(i => i.Id.Equals(id)).FirstOrDefault());
 }
Exemplo n.º 28
0
 void BindDepartment()
 {
     Doctors o = new Doctors();
     DataSet ds = o.getDepartment();
     DepartmentList.DataSource = ds;
     DepartmentList.DataTextField = "ShortName";
     DepartmentList.DataValueField = "Id";
     DepartmentList.DataBind();
     DepartmentList.Items.Insert(0, "Select");
 }
 private void CreateDoctors()
 {
     Doctors.Add(Doctor.Create(Id: 1, Name: "Stomatologist"));
     Doctors.Add(Doctor.Create(Id: 2, Name: "Ophthalmologist"));
     Doctors.Add(Doctor.Create(Id: 3, Name: "Surgeon"));
 }
Exemplo n.º 30
0
        static void MyIterator()
        {
            #region student
            Students students = new Students();
            Student st = new Student();
            st.Name = "lili";

            students.Add(st);
            st = new Student();
            st.Name = "OK";

            students.Add(st);

            foreach (Student obj in students)
            {
                Console.WriteLine(obj.Name);
            }
            #endregion

            #region teacher
            Teachers ts = new Teachers();
            Teacher t1 = new Teacher(1001, "t1", 33);
            Teacher t2 = new Teacher(1002, "t2", 34);
            ts.Add(t1);
            ts.Add(t2);

            foreach (Teacher t in ts)
            {
                Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString());
            }

            // other methods for the foreach
            {
                IEnumerator enumerator = ts.GetEnumerator();
                Teacher t;

                while (enumerator.MoveNext())
                {
                    t = (Teacher)enumerator.Current;
                    Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString());
                }
            }

            #endregion

            #region doctor
            // using IEnumerable<T> interface
            Doctors ds = new Doctors();
            Doctor d1 = new Doctor("lili", 28);
            Doctor d2 = new Doctor("wang", 30);
            ds.Add(d1);
            ds.Add(d2);

            foreach (Doctor d in ds)
            {
                Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
            }
            Console.WriteLine();

            {
                IEnumerator enumerator = ds.GetEnumerator();
                Doctor d;

                while (enumerator.MoveNext())
                {
                    d = (Doctor)enumerator.Current;
                    Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
                }
            }

            Console.WriteLine();

            {
                IEnumerator<Doctor> enumerator = ds.GetEnumerator();
                Doctor d;

                while (enumerator.MoveNext())
                {
                    d = enumerator.Current;
                    Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
                }
            }
            #endregion

            #region myStack

            MyStack<int> s = new MyStack<int>();
            for (int i = 0; i < 10; i++)
            {
                s.Push(i);
            }

            // Prints: 9 8 7 6 5 4 3 2 1 0
            // Foreach legal since s implements IEnumerable<int>
            foreach (int n in s)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 9 8 7 6 5 4 3 2 1 0
            // Foreach legal since s.TopToBottom returns IEnumerable<int>
            foreach (int n in s.TopToBottom)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 0 1 2 3 4 5 6 7 8 9
            // Foreach legal since s.BottomToTop returns IEnumerable<int>
            foreach (int n in s.BottomToTop)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 9 8 7 6 5 4 3
            // Foreach legal since s.TopN returns IEnumerable<int>
            foreach (int n in s.TopN(7))
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            #endregion
        }
Exemplo n.º 31
0
 public void addDoctor(Doctors add)
 {
     Context.Doctors.Add(add);
     Context.SaveChanges();
 }
Exemplo n.º 32
0
 public ActionResult UpdateDoctor(Doctors doctor)
 {
     elaticClient.InsertUpdate(doctor);
     return(RedirectToAction("Index", "Doctors"));
 }
Exemplo n.º 33
0
 void BindDoctorSchedule()
 {
     Doctors objDoc = new Doctors();
     Session["DoctorId"] = 1;
     objDoc.DoctorId = Convert.ToInt32(Session["DoctorId"]);
     DataSet ds = objDoc.GetDoctorScheduleById();
     if (ds.Tables.Count > 0)
     {
         if (ds.Tables[0].Rows.Count > 0)
         {
             gvDoctorSchedule.DataSource = ds;
             gvDoctorSchedule.DataBind();
         }
     }
 }
Exemplo n.º 34
0
 public void AddDoctor(IDoctor doctor)
 {
     Doctors.Add(doctor);
 }
        public ActionResult Edit([Bind(Include = "UserId,EndDate,status,StratDate,DoctorId,VId,UserId,Title,DoctorCategoryId,Location,YearsofExperience,Mobile,LandPhone,Email,Description,Image1,Image2,Image3,Date,Views,Status")] Doctors doctors, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3)
        {
            ViewBag.DoctorCategory = db.DoctorCategory.ToList();
            if (ModelState.IsValid)
            {
                if (file1 != null)
                {
                    //file1.SaveAs(HttpContext.Server.MapPath("~/Images/")+ file1.FileName);
                    //realEstate.Image1 = "/Images/"+file1.FileName;
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file1.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file1.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file1.FileName);
                                doctors.Image1 = "/Images/" + file1.FileName;
                            }
                        }
                    }
                }
                else if (doctors.Image1 != null)
                {
                }
                else
                {
                    doctors.Image1 = "/Images/nullimage.jpg";
                }
                if (file2 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file2.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file2.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file2.FileName);
                                doctors.Image2 = "/Images/" + file2.FileName;
                            }
                        }
                    }
                }
                else if (doctors.Image2 != null)
                {
                }
                else
                {
                    doctors.Image2 = "/Images/nullimage.jpg";
                }
                if (file3 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file3.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file3.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file3.FileName);
                                doctors.Image3 = "/Images/" + file3.FileName;
                            }
                        }
                    }
                }
                else if (doctors.Image3 != null)
                {
                }
                else
                {
                    doctors.Image3 = "/Images/nullimage.jpg";
                }
                doctors.Date            = DateTime.Now;
                db.Entry(doctors).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "MyAccount"));
            }
            return(View(doctors));
        }
Exemplo n.º 36
0
 public IActionResult Delete(Doctors doctor)
 {
     db.Doctors.Remove(doctor);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 37
0
        public JsonResult Edit(int?id)
        {
            Doctors aDoctors = this._contex.Doctorses.FirstOrDefault(dr => dr.Id == id);

            return(Json(aDoctors, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 38
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "ItemDoctors":
            {
                Doctors doctors = new Doctors();
                ContentC.Content = doctors;
                break;
            }

            case "ItemPatients":
            {
                if (Membership.CurrentUser.RoleID == 3)
                {
                    EditPatient editPatient = new EditPatient(Membership.CurrentUser.Patient.Id);
                    ContentC.Content = editPatient;
                }
                else
                {
                    Patients patients = new Patients();
                    ContentC.Content = patients;
                }
                break;
            }

            case "ItemVisits":
            {
                Visits visits = new Visits();
                ContentC.Content = visits;
                break;
            }

            case "ItemAddDoctor":
            {
                EditDoctor newForm = new EditDoctor();
                newForm.ShowDialog();
                break;
            }

            case "ItemAddAdmin":
            {
                EditUser newForm = new EditUser(0);
                newForm.ShowDialog();
                break;
            }

            case "ItemAddPatient":
            {
                EditPatient editpatient = new EditPatient(/*0*/);
                MainWindow.AppWindow.ContentC.Content = editpatient;
                break;
            }

            case "Statistics":
            {
                Statistics item = new Statistics();
                MainWindow.AppWindow.ContentC.Content = item;
                break;
            }

            default:

                break;
            }
        }
Exemplo n.º 39
0
 public void Clear()
 {
     Doctors?.Clear();
 }
Exemplo n.º 40
0
 private void Doctors_Click(object sender, RoutedEventArgs e)
 {
     var new_windows = new Doctors();
     new_windows.ShowDialog();
 }
 public ActionResult CreateDoctor(Doctors doctor)
 {
     db.Doctors.Add(doctor);
     db.SaveChanges();
     return(RedirectToAction("Index", "Doctors"));
 }
Exemplo n.º 42
0
 public ActionResult CreateDoctor(Doctors doctor)
 {
     doctor.Id = Guid.NewGuid();
     elaticClient.InsertDoctor(doctor);
     return(RedirectToAction("Index", "Doctors"));
 }