protected void btnConfirm_Click(object sender, EventArgs e)
        {
            int accountID = Convert.ToInt32(lbl_id.Text);

            AccountManagementSystem.DeleteAccount(accountID);
            Response.Write("<script type=\"text/javascript\">alert('Account Deleted!');location.href='AdminDeleteAccPage.aspx'</script>");
        }
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            Account a = new Account();

            a = (Account)Session["Account"];

            AccountManagementSystem.DeleteAccount(a.accountID);
            Session["Account"] = null;
            Response.Write("<script type=\"text/javascript\">alert('Account Deactivated!');location.href='LoginPage.aspx'</script>");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Account a = new Account();

            a = (Account)Session["Account"];

            if (a == null)
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (!a.accountType.Equals("admin"))
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (!IsPostBack)
            {
                int id = Int32.Parse((string)Session["doc_id"]);

                a = AccountManagementSystem.GetAccount(id);
                txtNric.Attributes.Add("placeholder", a.nric);
                txtName.Attributes.Add("placeholder", a.name);
                txtPassword.Attributes.Add("placeholder", a.password);
                txtEmail.Attributes.Add("placeholder", a.email);
                txtAddress.Attributes.Add("placeholder", a.address);

                Department D = new Department();
                D = DepartmentManagementSystem.GetDepartmentByUserID(id);


                Facility F = new Facility();
                F = FacilityManagementSystem.GetFacility(D.facilityId);

                FacilityDropDownList.DataSource = FacilityManagementSystem.GetAllfacility();
                FacilityDropDownList.DataBind();

                FacilityDropDownList.SelectedValue = F.facilityID.ToString();


                DepartmentDropDownList.DataSource = DepartmentManagementSystem.getDepartmentsFromThisFacility(FacilityDropDownList.SelectedItem.Value);
                DepartmentDropDownList.DataBind();


                DepartmentDropDownList.SelectedValue = D.departmentID.ToString();
            }
        }
Beispiel #4
0
        protected void YesButton_Click(object sender, EventArgs e)
        {
            //get account id
            string  nric = Session["nric"].ToString();
            Account a    = new Account();

            a = AccountManagementSystem.getAccountViaNRIC(nric);

            int accountID = 1;

            if (a != null)
            {
                accountID = a.accountID;
            }
            int time;

            if (AMPMDropDownList.SelectedValue.ToString() == "PM")
            {
                time = (Convert.ToInt32(HourDropDownList.SelectedValue)) * 10000 + Convert.ToInt32(MinDropDownList.SelectedValue) * 100;
            }
            else
            {
                time = Convert.ToInt32(HourDropDownList.SelectedValue) * 10000 + Convert.ToInt32(MinDropDownList.SelectedValue) * 100;
            }

            //insert values into database and redirect to patientappointment page
            Appointment ap = new Appointment();

            ap.accountID    = accountID;
            ap.facilityID   = Convert.ToInt32(HospitalDropDownList.SelectedValue);
            ap.departmentID = Convert.ToInt32(DepartmentDropDownList.SelectedValue);
            ap.time         = time.ToString();
            ap.date         = DateTextBox.Text; //this was lblActualDate.Text. is this intentional?
            ap.comments     = "Referral - " + CommentTextBox.Text.ToString();
            int result = AppointmentManagementSystem.bookAppointment(ap);

            string id = Session["id"].ToString();

            result = AppointmentManagementSystem.deleteAppointment(id);

            if (result == 1)
            {
                Response.Write("<script type=\"text/javascript\">alert('Appointment Added!');location.href='DoctorAppointmentPage.aspx'</script>");
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Account a = new Account();

            a = (Account)Session["Account"];

            if (a == null)
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (!a.accountType.Equals("Doctor"))
            {
                Response.Redirect("LoginPage.aspx");
            }
            if (Session["nric"] == null)
            {
                Response.Redirect("DoctorAppointmentPage.aspx");
            }
            DateTextBox.Attributes.Add("readonly", "readonly");//prevents textbox from losing text after postback
            if (!IsPostBack)
            {
                //set namedropdownlist names

                string nric = Session["nric"].ToString();

                a            = AccountManagementSystem.getAccountViaNRIC(nric);
                lb_name.Text = a.name;
                lb_id.Text   = a.accountID.ToString();

                //set hospitaldropdownlist
                HospitalDropDownList.DataSource     = FacilityManagementSystem.GetAllfacility();
                HospitalDropDownList.DataTextField  = "facility_name";
                HospitalDropDownList.DataValueField = "facility_id";
                HospitalDropDownList.DataBind();

                HospitalDropDownList.Items.Insert(0, new ListItem("-Select a Hospital-", "-1"));//add blank space at top of droplist
            }
        }
        protected void UpDate_Click(object sender, EventArgs e)
        {
            Account a     = new Account();
            Boolean check = true;


            Account update = new Account();

            a = AccountManagementSystem.GetAccount(Int32.Parse((string)Session["doc_id"]));

            if (string.IsNullOrEmpty(txtNric.Text))
            {
                update.nric = txtNric.Text = a.nric;
            }
            else
            {
                update.nric = txtNric.Text;
            }

            if (string.IsNullOrEmpty(txtName.Text))
            {
                update.name = txtName.Text = a.name;
            }
            else
            {
                update.name = txtName.Text;
            }

            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                update.email = txtEmail.Text = a.email;
            }
            else
            {
                update.email = txtEmail.Text;
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                update.password = txtPassword.Text = a.password;
            }
            else
            {
                update.password = txtPassword.Text;
            }


            if (string.IsNullOrEmpty(txtAddress.Text))
            {
                update.address = txtAddress.Text = a.address;
            }
            else
            {
                update.address = txtAddress.Text;
            }

            if (DepartmentDropDownList.SelectedItem == null)
            {
                lblDepartment.Text = "This facility do not have department for the doctor to join";
                check = false;
            }

            if (ImageUpload.HasFile)
            {
                string ext = System.IO.Path.GetExtension(ImageUpload.PostedFile.FileName);

                byte[] bytes = ImageUpload.FileBytes;
                int    width;
                int    height;

                using (Stream memStream = new MemoryStream(bytes))
                {
                    using (System.Drawing.Image img = System.Drawing.Image.FromStream(memStream))
                    {
                        width  = img.Width;
                        height = img.Height;
                    }
                }
                if (!Validation.ImageCheck(ext))
                {
                    lblImage.Text = "This Picture format is not supported by the system";
                    check         = false;
                }
                else if (width > 500 || height > 300)
                {
                    lblImage.Text = "Profile Picture size does not meet specified requirements 500x300 pixels";
                    check         = false;
                }
                else
                {
                    update.photo = Path.GetFileName(ImageUpload.PostedFile.FileName);
                    ImageUpload.PostedFile.SaveAs(Server.MapPath("~/upload/user/") + update.photo);
                }
            }
            else
            {
                update.photo = a.photo;
            }

            if (check == true)
            {
                update.accountType = a.accountType;
                //Session["Account"] = update;
                AccountManagementSystem.UpdateAccount(txtName.Text, txtPassword.Text, txtEmail.Text, txtAddress.Text, txtNric.Text, update.photo, a.accountID);



                int Departmentid = Int32.Parse(DepartmentDropDownList.SelectedValue);

                AccountManagementSystem.UpdateFacilityStaff(a.accountID, Departmentid);

                Response.Write("<script type=\"text/javascript\">alert('Account Info is successfully updated!');location.href='AdminHomePage.aspx'</script>");
            }
        }
Beispiel #7
0
        protected void CreatrDocAcc_Click(object sender, EventArgs e)
        {
            bool check = true;

            lblPassword.Text = lblAddress.Text = lblEmail.Text = lblName.Text = lblPassword.Text = lblConfirmPassword.Text = lblNric.Text = "";
            if (Validation.isEmpty(txtName.Text))
            {
                lblName.Text = "Name cannot be empty";
                check        = false;
            }
            if (Validation.isEmpty(txtNric.Text))
            {
                lblNric.Text = "NRIC cannot be empty";
                check        = false;
            }
            if (Validation.isEmpty(txtPassword.Text))
            {
                lblPassword.Text = "Password cannot be empty";
                check            = false;
            }
            if (Validation.isEmpty(txtConfirmPassword.Text))
            {
                lblConfirmPassword.Text = "Password cannot be empty";
                check = false;
            }

            if (Validation.isEmpty(txtEmail.Text))
            {
                lblEmail.Text = "Email cannot be empty";
                check         = false;
            }

            if (Validation.isEmpty(txtAddress.Text))
            {
                lblAddress.Text = "Address cannot be empty";
                check           = false;
            }

            if (!Validation.isEmpty(txtNric.Text) && Validation.checkNricExist(txtNric.Text))
            {
                lblNric.Text = "This NRIC already got an account";
                check        = false;
            }

            if (Validation.ComparePassword(txtPassword.Text, txtConfirmPassword.Text) == false)

            {
                lblPassword.Text = "Please re-enter password, Passwords are different";
                check            = false;
            }

            if (Validation.CheckEmail(txtEmail.Text) == false)
            {
                lblEmail.Text = "Invalid Email";
                check         = false;
            }

            if (DepartmentDropDownList.SelectedItem == null)
            {
                lblDepartment.Text = "This facility do not have department for the doctor to join";
                check = false;
            }
            if (DepartmentDropDownList.SelectedValue.ToString() == "-1")
            {
                lblDepartment.Text = "Please select a department";
                check = false;
            }
            if (ImageUpload.HasFile)
            {
                string ext   = System.IO.Path.GetExtension(ImageUpload.PostedFile.FileName);
                byte[] bytes = ImageUpload.FileBytes;
                int    width;
                int    height;

                using (Stream memStream = new MemoryStream(bytes))
                {
                    using (System.Drawing.Image img = System.Drawing.Image.FromStream(memStream))
                    {
                        width  = img.Width;
                        height = img.Height;
                    }
                }
                if (!Validation.ImageCheck(ext))
                {
                    check         = false;
                    lblImage.Text = "Invalid image type";
                }
                else if (width > 500 || height > 300)
                {
                    lblImage.Text = "Profile Picture size does not meet specified requirements 500x300 pixels";
                    check         = false;
                }
            }


            if (check == true)
            {
                Account a = new Account();
                a.name     = txtName.Text;
                a.nric     = txtNric.Text;
                a.password = txtPassword.Text;
                a.email    = txtEmail.Text;
                a.address  = txtAddress.Text;

                if (ImageUpload.HasFile)
                {
                    a.photo = Path.GetFileName(ImageUpload.PostedFile.FileName);
                    ImageUpload.PostedFile.SaveAs(Server.MapPath("~/images/") + a.photo);
                }
                ;

                int deptID = Int32.Parse(DepartmentDropDownList.SelectedValue);

                AccountManagementSystem.createDocAccount(a, deptID);

                txtAddress.Text  = txtEmail.Text = txtName.Text = txtNric.Text = "";
                lblPassword.Text = lblAddress.Text = lblEmail.Text = lblName.Text = lblPassword.Text = lblConfirmPassword.Text = lblNric.Text = "";
                Response.Write("<script type=\"text/javascript\">alert('Account is created successfully!');location.href='AdminHomePage.aspx'</script>");
            }
        }
 private void bindAppointments()
 {
     grdAllDocAcc.DataSource = AccountManagementSystem.getAllDoctorAcc();
     grdAllDocAcc.DataBind();
 }
        protected void create_Click(object sender, EventArgs e)
        {
            bool check = true;

            lblPassword.Text = lblAddress.Text = lblEmail.Text = lblName.Text = lblPassword.Text = lblConfirmPassword.Text = lblNric.Text = "";
            if (Validation.isEmpty(txtName.Text))
            {
                lblName.Text = "Name cannot be empty";
                check        = false;
            }
            if (Validation.isEmpty(txtNric.Text))
            {
                lblNric.Text = "NRIC cannot be empty";
                check        = false;
            }
            if (Validation.isEmpty(txtPassword.Text))
            {
                lblPassword.Text = "Password cannot be empty";
                check            = false;
            }
            if (Validation.isEmpty(txtConfirmPassword.Text))
            {
                lblConfirmPassword.Text = "Password cannot be empty";
                check = false;
            }

            if (Validation.isEmpty(txtEmail.Text))
            {
                lblEmail.Text = "Email cannot be empty";
                check         = false;
            }

            if (Validation.isEmpty(txtAddress.Text))
            {
                lblAddress.Text = "Address cannot be empty";
                check           = false;
            }

            if (!Validation.isEmpty(txtNric.Text) && Validation.checkNricExist(txtNric.Text))
            {
                lblNric.Text = "There is already an account with this nric number";
                check        = false;
            }

            if (Validation.ComparePassword(txtPassword.Text, txtConfirmPassword.Text) == false)

            {
                lblPassword.Text = "Confirmed password does not match";
                check            = false;
            }

            if (Validation.CheckEmail(txtEmail.Text) == false)
            {
                lblEmail.Text = "Invalid Email Address format";
                check         = false;
            }

            if (ImageUpload.HasFile)
            {
                string ext = System.IO.Path.GetExtension(ImageUpload.PostedFile.FileName);

                byte[] bytes = ImageUpload.FileBytes;
                int    width;
                int    height;

                using (Stream memStream = new MemoryStream(bytes))
                {
                    using (System.Drawing.Image img = System.Drawing.Image.FromStream(memStream))
                    {
                        width  = img.Width;
                        height = img.Height;
                    }
                }
                if (!Validation.ImageCheck(ext))
                {
                    check         = false;
                    lblImage.Text = "This Picture format is not supported by the system";
                }
                else if (width > 500 || height > 300)
                {
                    lblImage.Text = "Profile Picture size does not meet specified requirements 500x300 pixels";
                    check         = false;
                }
            }


            if (check == true)
            {
                Account a = new Account();
                a.name     = txtName.Text;
                a.nric     = txtNric.Text;
                a.password = txtPassword.Text;
                a.email    = txtEmail.Text;
                a.address  = txtAddress.Text;

                if (ImageUpload.HasFile)
                {
                    a.photo = Path.GetFileName(ImageUpload.PostedFile.FileName);
                    ImageUpload.PostedFile.SaveAs(Server.MapPath("~/upload/user/") + a.photo);
                }

                AccountManagementSystem.createAccount(a);

                Response.Write("<script type=\"text/javascript\">alert('Account is created successfully!');location.href='LoginPage.aspx'</script>");
            }
        }