private void bindFacility() { Facility f = new Facility(); grdFacility.DataSource = FacilityManagementSystem.GetFacility(); grdFacility.DataBind(); }
private void bindData() { List <SearchResults> results = FacilityManagementSystem.getAPIData(txtName.Text); DataTable dt = new DataTable(); dt.Columns.Add("Building"); dt.Columns.Add("Address"); dt.Columns.Add("Postal"); dt.Columns.Add("x"); dt.Columns.Add("y"); if (results != null) { for (int i = 0; i < results.Count; i++) { dt.Rows.Add(); dt.Rows[i]["Building"] = results.ElementAt(i).building; dt.Rows[i]["Address"] = results.ElementAt(i).address; dt.Rows[i]["Postal"] = results.ElementAt(i).postal; dt.Rows[i]["x"] = results.ElementAt(i).x; dt.Rows[i]["y"] = results.ElementAt(i).y; } } grdFacilities.DataSource = dt; grdFacilities.DataBind(); confirmPopup.Show(); }
protected void Page_Load(object sender, EventArgs e) { Account a = new Account(); a = (Account)Session["Account"]; if (a == null) { btnBookAppointment.Visible = false; } facilityName = Request.QueryString["name"]; Facility facility = FacilityManagementSystem.GetFacilityFromName(facilityName); if (facility == null) { return; } facilityId = facility.facilityID; lblName.Text = facility.facilityName; lblInformation.Text = facility.generalInfo; lblContact.Text = facility.phoneNumber.ToString(); lblAddress.Text = facility.address; lblOperatingHours.Text = string.Format("{0} to {1}", facility.openingHrs, facility.closingHrs); Session["F_image"] = facility.image; if (!IsPostBack) { BindRatings(); BindComments(); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(Request.QueryString["q"])) { return; } List <SearchResults> locations = FacilityManagementSystem.getAPIData(Uri.EscapeDataString(Request.QueryString["q"])); if (locations == null || locations.Count == 0) { return; } SearchResults location = locations[0]; List <Facility> facilities = FacilityManagementSystem.SearchNearby(Decimal.Parse(location.x), Decimal.Parse(location.y)); location_list = facilities.Select(f => Svy21.ComputeLatitudeLongitude((double)f.x, (double)f.y)).ToList(); this.location = Svy21.ComputeLatitudeLongitude(Double.Parse(location.x), Double.Parse(location.y)); var points = location_list.Concat(new[] { this.location }); this.upperbound = Tuple.Create(points.Select(p => p.Item1).Max(), points.Select(p => p.Item2).Max()); this.lowerbound = Tuple.Create(points.Select(p => p.Item1).Min(), points.Select(p => p.Item2).Min()); listResults.DataSource = facilities; listResults.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Account a = new Account(); a = (Account)Session["Account"]; if (a == null) { Response.Redirect("LoginPage.aspx"); } facilityName = Request.QueryString["q"]; DateTextBox.Attributes.Add("readonly", "readonly");//prevents textbox from losing text after postback if (!IsPostBack) { //set namedropdownlist names //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 if (facilityName != null) { HospitalDropDownList.Items.FindByText(facilityName).Selected = true; HospitalDropDownList_SelectedIndexChanged(null, null); } } }
private void bindData() { string selected = rbnCategory.SelectedValue; grdPharmacy.DataSource = FacilityManagementSystem.getPharmacyData(selected); grdPharmacy.DataBind(); }
protected void btnConfirm_Click(object sender, EventArgs e) { String id = lbl_id.Text; DepartmentManagementSystem.DeleteDepartments(id); //delete child FacilityManagementSystem.DeleteFacility(id); Response.Write("<script type=\"text/javascript\">alert('Facility Deleted!');location.href='FacilityListPage.aspx'</script>"); }
protected void Page_Load(object sender, EventArgs e) { List <Facility> facilities = FacilityManagementSystem.SearchFacility(Request.QueryString["q"] ?? ""); if (facilities == null || facilities.Count == 0) { noResults = true; return; } listResults.DataSource = facilities; listResults.DataBind(); }
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) { String id = (String)Session["fac_id"]; Facility f = new Facility(); f = FacilityManagementSystem.GetFacility(id); txtName.Attributes.Add("placeholder", f.facilityName); txtInfo.Attributes.Add("placeholder", f.generalInfo); txtPhoneNumber.Attributes.Add("placeholder", f.phoneNumber.ToString()); string[] OpeningTimeArray = f.openingHrs.Split(':'); UpdateOpeninghr.SelectedValue = OpeningTimeArray[0] + ":" + OpeningTimeArray[1]; string[] ClosingTimeArray = f.closingHrs.Split(':'); UpdateClosinghr.SelectedValue = ClosingTimeArray[0] + ":" + ClosingTimeArray[1]; txtAddress.Attributes.Add("placeholder", f.address); txtRegion.Attributes.Add("placeholder", f.region); listFacility.SelectedValue = f.facilityType; List <Department> Deptlist = DepartmentManagementSystem.getDepartments(id); //////////////////////////////////////Department can't be deleted because doctor is tied to the department for (int i = 0; i < Deptlist.Count; i++) { foreach (ListItem listItem in UpdateDepartmentList.Items) { if (listItem.Value.Equals(Deptlist.ElementAt(i).departmentName)) { listItem.Selected = true; } } } } }
protected void HospitalDropDownList_SelectedIndexChanged(object sender, EventArgs e) { //set opening and closing label to visible if (HospitalDropDownList.SelectedItem.ToString() != "-Select a Hospital-") { lb_openingHrs.Visible = true; lb_closingHrs.Visible = true; lblHospital.Visible = false; } else { lb_openingHrs.Visible = false; lb_closingHrs.Visible = false; } lblTime.Text = ""; DepartmentDropDownList.DataSource = DepartmentManagementSystem.getDepartments(HospitalDropDownList.SelectedValue.ToString()); DepartmentDropDownList.DataTextField = "departmentName"; DepartmentDropDownList.DataValueField = "departmentID"; DepartmentDropDownList.DataBind(); DepartmentDropDownList.Items.Insert(0, new ListItem("(Select a Department)", "-1")); //get opening hours and set it if (HospitalDropDownList.SelectedValue.ToString() != "-1") { Facility f = FacilityManagementSystem.getOpeningHrs(HospitalDropDownList.SelectedValue.ToString()); HourChange("AM"); AMPMDropDownList.ClearSelection(); AMPMDropDownList.Items.FindByText(f.openingHrs.Substring(4, 2)).Selected = true; lb_actualOpening.Text = f.generalInfo; lb_actualClosing.Text = f.region; lb_actualClosing.Visible = true; lb_actualOpening.Visible = true; } else { HourDropDownList.Items.Clear(); HourDropDownList.Items.Insert(0, new ListItem("-Hr-", "-1")); MinDropDownList.Items.Clear(); MinDropDownList.Items.Insert(0, new ListItem("-Min-", "-1")); AMPMDropDownList.ClearSelection(); lb_actualClosing.Visible = false; lb_actualOpening.Visible = false; } }
void MinChange(int hour) { Facility f = FacilityManagementSystem.getOpeningHrs(HospitalDropDownList.SelectedValue.ToString()); int openHours = Convert.ToInt32(f.openingHrs.Substring(0, 2)); int closeHours = Convert.ToInt32(f.closingHrs.Substring(0, 2)); int openMins = Convert.ToInt32(f.openingHrs.Substring(2, 2)); int closeMins = Convert.ToInt32(f.closingHrs.Substring(2, 2)); MinDropDownList.Items.Clear(); MinDropDownList.Items.Insert(0, new ListItem("-Min-", "-1"));//add heading in dropdownlist if (hour == openHours) { for (int min = openMins; min <= 45; min = min + 15) { MinDropDownList.Items.Add(new ListItem(min.ToString(), min.ToString())); } } else if (hour == closeHours - 1) { for (int min = 0; min <= closeMins; min = min + 15) { MinDropDownList.Items.Add(new ListItem(min.ToString(), min.ToString())); } } else if (hour == -1) { //do nothing~ } else { for (int i = 0; i <= 45; i = i + 15) { MinDropDownList.Items.Add(new ListItem(i.ToString(), i.ToString())); } } //set selected min to first index MinDropDownList.ClearSelection(); if (hour != -1) { MinDropDownList.SelectedIndex = 1; } //change the text "0" to "00" if (MinDropDownList.SelectedItem.ToString() == "0") { MinDropDownList.SelectedItem.Text = "00"; } }
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(); } }
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) { FacilityDropDownList.DataSource = FacilityManagementSystem.GetAllfacility(); FacilityDropDownList.DataBind(); FacilityDropDownList.Items.Insert(0, new ListItem("- Select faciliy -", "-1")); } }
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) { String id = (String)Session["fac_id"]; Facility f = new Facility(); f = FacilityManagementSystem.GetFacility(id); if (string.IsNullOrEmpty(txtName.Text)) { txtName.Text = f.facilityName; } if (string.IsNullOrEmpty(txtInfo.Text)) { txtInfo.Text = f.generalInfo; } if (string.IsNullOrEmpty(txtPhoneNumber.Text)) { txtPhoneNumber.Text = f.phoneNumber.ToString(); } if (string.IsNullOrEmpty(txtAddress.Text)) { txtAddress.Text = f.address; } if (string.IsNullOrEmpty(txtRegion.Text)) { txtRegion.Text = f.region; } String image = f.image; if (ImageUpload.HasFile) { string ext = System.IO.Path.GetExtension(ImageUpload.PostedFile.FileName); if (!Validation.ImageCheck(ext)) { lblImage.Text = "Invalid image type"; } else { image = Path.GetFileName(ImageUpload.PostedFile.FileName); ImageUpload.PostedFile.SaveAs(Server.MapPath("~/upload/facility/") + image); } } FacilityManagementSystem.UpdateFacility(txtName.Text, listFacility.SelectedItem.Text, txtInfo.Text, Convert.ToInt32(txtPhoneNumber.Text), UpdateOpeninghr.SelectedItem.Text + ":" + "00", UpdateClosinghr.SelectedItem.Text + ":" + "00", txtAddress.Text, txtRegion.Text, image, f.facilityID); //need to check whether there's any doctor with these department Department[] dp = new Department[12]; //selected Department[] ndp = new Department[12]; //not selected int index = 0; int nindex = 0; foreach (ListItem listItem in UpdateDepartmentList.Items) { if (listItem.Selected) { dp[index] = new Department(); dp[index].facilityId = f.facilityID; dp[index].departmentName = listItem.Value; index++; } else { ndp[nindex] = new Department(); ndp[nindex].facilityId = f.facilityID; ndp[nindex].departmentName = listItem.Value; nindex++; } } bool DepartmentCheckexist = false; //this is to check whether there's child dependency for facility_staff before deleting the uncheck facility to prevent database error String tempDeptName; foreach (Department d in ndp) { if (d != null) { tempDeptName = DepartmentManagementSystem.CheckDepartmentForStaff(d); if (tempDeptName != null) { lblImage.Text = "unable to remove department: " + tempDeptName + ", there are doctors working in that department"; DepartmentCheckexist = true;//don't allow the update } } } if (DepartmentCheckexist == false) { DepartmentManagementSystem.DeleteDepartment(ndp); DepartmentManagementSystem.AddDepartment(dp); Response.Write("<script type=\"text/javascript\">alert('Facility Updated!');location.href='AdminHomePage.aspx'</script>"); } }
protected void Create_Click(object sender, EventArgs e) { bool check = true; if (Validation.isEmpty(txtName.Text)) { lblName.Text = "Name cannot be empty"; check = false; } if (Validation.isEmpty(txtInfo.Text)) { lblInfo.Text = "Info cannot be empty"; check = false; } if (Validation.isEmpty(txtPhoneNumber.Text)) { lblPhoneNumber.Text = "PhoneNumber cannot be empty"; check = false; } if (Validation.isEmpty(txtOpeninghr.Text)) { lblOpening.Text = "Opening Hours cannot be empty"; check = false; } if (Validation.isEmpty(txtClosinghr.Text)) { lblClosing.Text = "Closing Hours cannot be empty"; check = false; } if (Validation.isEmpty(txtAddress.Text)) { lblAddress.Text = "Address cannot be empty"; check = false; } if (Validation.isEmpty(txtRegion.Text)) { lblRegion.Text = "Region cannot be empty"; 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 > 720 || height > 480) { lblImage.Text = "Profile Picture size does not meet specified requirements 720x480 pixels"; check = false; } } if (CreateDepartmentList.Items.Cast <ListItem>().Count(li => li.Selected) == 0) { check = false; lblDepartmentList.Text = "Please select at least 1 department"; } if (check == true) { Facility f = new Facility(); f.facilityName = txtName.Text; f.facilityType = listFacility.SelectedItem.Text; f.generalInfo = txtInfo.Text; f.phoneNumber = Int32.Parse(txtPhoneNumber.Text); f.openingHrs = txtOpeninghr.SelectedItem.Text + ":" + "00"; f.closingHrs = txtClosinghr.SelectedItem.Text + ":" + "00"; f.address = txtAddress.Text; f.region = txtRegion.Text; f.x = Decimal.Parse(lblSelectedX.Text); f.y = Decimal.Parse(lblSelectedY.Text); if (ImageUpload.HasFile) { f.image = Path.GetFileName(ImageUpload.PostedFile.FileName); ImageUpload.PostedFile.SaveAs(Server.MapPath("~/upload/facility/") + f.image); } if (!FacilityManagementSystem.CheckFacilityName(f.facilityName)) { FacilityManagementSystem.CreateFacility(f); /////////////////////////To add data department table/////////////////////////// int facility_id = FacilityManagementSystem.GetFacilityId(f.facilityName); //only after facility is created will there be facility id Department[] dp = new Department[12]; int index = 0; foreach (ListItem listItem in CreateDepartmentList.Items) { if (listItem.Selected) { dp[index] = new Department(); dp[index].facilityId = facility_id; dp[index].departmentName = listItem.Value; index++; } } DepartmentManagementSystem.AddDepartment(dp); txtName.Text = txtInfo.Text = txtPhoneNumber.Text = txtOpeninghr.Text = txtClosinghr.Text = txtAddress.Text = txtRegion.Text = ""; lblName.Text = lblInfo.Text = lblPhoneNumber.Text = lblOpening.Text = lblClosing.Text = lblAddress.Text = lblRegion.Text = ""; foreach (ListItem listItem in CreateDepartmentList.Items) { if (listItem.Selected) { listItem.Selected = false; } } Response.Write("<script type=\"text/javascript\">alert('Facility Created!');location.href='AdminHomePage.aspx'</script>"); //Response.Redirect("AdminHomePage.aspx", false); } else { lblImage.Text = "This hospital already exist in the database"; } } }
void HourChange(string AMPM) { Facility f = FacilityManagementSystem.getOpeningHrs(HospitalDropDownList.SelectedValue.ToString()); int openHours = Convert.ToInt32(f.openingHrs.Substring(0, 2)); int closeHours = Convert.ToInt32(f.closingHrs.Substring(0, 2)); HourDropDownList.Items.Clear(); if (AMPM == "AM") { if (openHours > 12)//if opening time after 12pm no time slot in am { HourDropDownList.Items.Add(new ListItem("No time slot!", "-1")); } else { for (openHours = openHours + 0; openHours < closeHours && openHours < 12; openHours++)//add time slot in dropdownlist { HourDropDownList.Items.Add(new ListItem(openHours.ToString(), openHours.ToString())); } } } else if (AMPM == "PM") { if (closeHours < 12)//if closing time before 12pm no slot for pm slot { HourDropDownList.Items.Add(new ListItem("No time slot!", "-1")); } else { if (openHours < 12)//if opening time before 12pm set open to 12pm for pm slot { openHours = 12; } for (openHours = openHours + 0; openHours < closeHours; openHours++) { if (openHours != 12) { HourDropDownList.Items.Add(new ListItem((openHours - 12).ToString(), openHours.ToString()));//minus 12 cos time is in 24 hr format. 12pm dunnid minus } else { HourDropDownList.Items.Add(new ListItem((openHours).ToString(), openHours.ToString())); } } } } HourDropDownList.ClearSelection(); //add "0" to single digit number. e.g. "8" becomes "08" foreach (ListItem li in HourDropDownList.Items) { if (Convert.ToInt32(li.Value) < 10) { li.Text = "0" + li.Text; li.Value = li.Text; } } HourDropDownList.Items.Insert(0, new ListItem("-Hr-", "-1"));//add heading in dropdownlist //set default value of hour HourDropDownList.ClearSelection(); HourDropDownList.SelectedIndex = 1; openHours = Convert.ToInt32(f.openingHrs.Substring(0, 2)); //reset open time if (AMPM == "PM" && openHours < 12) //if opening time before 12pm set open to 12pm for pm slot { openHours = 12; } MinChange(openHours);//set mins }