public void TestDonateBlood() { BloodBL bl = new BloodBL(); BloodAvailability ba = new BloodAvailability(1, "A+", "AP", "area1", 123456, 9987654321); Assert.AreEqual(1, bl.DonateBlood(ba, 1)); }
protected void btnSubmitQuery_Click(object sender, EventArgs e) { try { string query = txtQuery.Text; string description = txtDescription.Text; RaiseQuery raiseQuery = new RaiseQuery(); raiseQuery.Query = query; raiseQuery.Description = description; raiseQuery.Status = "In Progress"; raiseQuery.Result = "No Result"; BloodBL bl = new BloodBL(); int result = bl.RaiseQuery(raiseQuery, int.Parse(lblUserId.Text)); if (result == 1) { Response.Write("<script>alert('Query Raised Successfully');window.location.href='FAQ.aspx';</script>"); } else { Response.Write("<script>alert('Error in raising query');window.location.href='FAQ.aspx';</script>"); } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
public void TestGetAllBloodPostings() { BloodBL bl = new BloodBL(); List <BloodPosting> bpList = bl.GetAllBloodPostings(); Assert.AreEqual(3, bpList.Count); }
public void TestSaveHospital() { BloodBL bl = new BloodBL(); Hospital h = new Hospital(1, "Appolo", " ", "Mumbai", DateTime.Parse("10/12/1990"), "09:00"); Assert.AreEqual(1, bl.SaveHospital(h, 1)); }
protected void DisplayData() { try { BloodBL bl = new BloodBL(); List <BloodAvailability> baList = bl.GetAllBloodAvailabilities(stateDropDownList.SelectedValue.ToString(), AreaDropDownList.SelectedValue.ToString(), bloodGroupDropDownList.SelectedValue.ToString()); if (baList.Count > 0) { BloodDonorAvailableGridView.Visible = true; BloodDonorAvailableGridView.DataSource = baList; BloodDonorAvailableGridView.DataBind(); searchResultsLabel.Text = ""; bloodRequirementsButton.Visible = false; } else { searchResultsLabel.Text = "Sorry, No results Found.. Post your Blood Requirements by clicking below button."; bloodRequirementsButton.Visible = true; BloodDonorAvailableGridView.Visible = false; } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session[Constants.userId].ToString() != null || Session[Constants.userId].ToString() != "") { lblUserId.Text = Session[Constants.userId].ToString(); } else { throw new NullReferenceException(); } lblUserId.Visible = false; Session[Constants.userId] = lblUserId.Text; BloodBL bl = new BloodBL(); List <string> states = bl.GetStateFromHospitalById(int.Parse(lblUserId.Text)); ddlState.DataSource = states; ddlState.DataBind(); ddlState.Items.Insert(0, "Select State"); } catch (Exception ee) { Response.Write("<script>alert('Your session expired...Please login again');window.location.href='HomePageBeforeLogin.aspx'</script>"); } } }
protected void radioMyLocation_CheckedChanged(object sender, EventArgs e) { try { if (radioMyLocation.Checked == true) { radioOtherLocation.Checked = false; panelOtherLocation.Visible = false; panelMyLocation.Visible = true; UserBL userBL = new UserBL(); BloodBL bl = new BloodBL(); User userDetails = userBL.GetUser(Session[Constants.userEmail].ToString()); txtStateMyLocation.Text = userDetails.State; txtAreaMyLocation.Text = userDetails.Area; txtPincodeMyLocation.Text = userDetails.Pincode.ToString(); txtBloodGroupMyLocation.Text = userDetails.BloodGroup; txtContactNumberMyLocation.Text = userDetails.ContactNumber.ToString(); List <string> hospitals = bl.GetHospitalsByStateArea(userDetails.State, userDetails.Area); ddlHospitalMyLocation.DataSource = hospitals; ddlHospitalMyLocation.DataBind(); ddlHospitalMyLocation.Items.Insert(0, "Select Hospital"); } } catch (Exception ex) { Response.Write("<script>alert('Your session expired...Please login again');window.location.href='HomePageBeforeLogin.aspx'</script>"); } }
public void TestGetAllFeedbackComments() { BloodBL bl = new BloodBL(); List <Feedback> fList = bl.GetAllFeedbackComments(); Assert.AreEqual(3, fList.Count); }
public void TestBloodPosting() { BloodBL bl = new BloodBL(); int result = bl.PostBlood(new BloodPosting(1, "B+", "AndhraPradesh", "Guntur", 522001, 9790703771), 7); Assert.AreEqual(1, result); }
protected void btnFeedback_Click(object sender, EventArgs e) { try { Feedback f = new Feedback(); f.HospitalName = ddlHospital.SelectedItem.Text; f.State = ddlState.SelectedItem.Text; f.Area = ddlArea.SelectedItem.Text; f.FeedbackComments = txtFeedback.Text; BloodBL bl = new BloodBL(); int result = bl.SaveFeedbackComments(f, int.Parse(lblUserId.Text)); if (result == 1) { Response.Write("<script>alert('Thank you for Feedback');window.location.href='HomePage.aspx';</script>"); } else { Response.Write("<script>alert('Your feedback not saved properly... provide feedback again');window.location.href='Feedback';</script>"); } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
public void TestGetQueries() { BloodBL bl = new BloodBL(); List <RaiseQuery> rqList = bl.GetQueryStatus(7); Assert.AreEqual(1, rqList.Count); }
public void TestGetBloodAvailability() { BloodBL bl = new BloodBL(); List <BloodAvailability> availabilityList = bl.GetAllBloodAvailabilities("Ap", "a", "A+"); Assert.AreEqual(2, availabilityList.Count); }
public void TestSaveFeedbackComments() { BloodBL bl = new BloodBL(); Feedback f = new Feedback("Appolo", "Telangana", "Hyderabad", "Not Bad"); Assert.AreEqual(1, bl.SaveFeedbackComments(f, 1)); }
protected void DisplayBloodAvailabilities() { BloodBL bl = new BloodBL(); List <BloodAvailability> baList = bl.GetAllBloodAvailabilities(); GridViewBloodAvailabilities.DataSource = baList; GridViewBloodAvailabilities.DataBind(); }
protected void DisplayFeedbackComments() { BloodBL bl = new BloodBL(); List <Feedback> feedbackList = bl.GetAllFeedbackComments(); GridViewFeedbackComments.DataSource = feedbackList; GridViewFeedbackComments.DataBind(); }
protected void DisplayBloodDonationNeeded() { BloodBL bl = new BloodBL(); List <BloodPosting> bpList = bl.GetAllBloodPostings(); GridViewBloodNeeded.DataSource = bpList; GridViewBloodNeeded.DataBind(); }
protected void DisplayQueries() { BloodBL bl = new BloodBL(); List <RaiseQuery> rqList = bl.GetAllQueries(); GridViewResolveQueries.DataSource = rqList; GridViewResolveQueries.DataBind(); }
protected void btnMyLocationSubmit_Click(object sender, EventArgs e) { try { BloodAvailability ba = new BloodAvailability(); ba.State = txtStateMyLocation.Text; ba.Area = txtAreaMyLocation.Text; ba.Pincode = int.Parse(txtPincodeMyLocation.Text); ba.BloodGroup = txtBloodGroupMyLocation.Text; ba.ContactNumber = long.Parse(txtContactNumberMyLocation.Text); Hospital h = new Hospital(); h.State = txtStateMyLocation.Text; h.Area = txtAreaMyLocation.Text; h.HospitalName = ddlHospitalMyLocation.SelectedItem.Text; if (txtDateMyLocation.Text != "" || txtDateMyLocation.Text != null) { if (DateTime.Compare(DateTime.Parse(txtDateMyLocation.Text), DateTime.Now) < 0) { //lblDateMyLocation.Text = "* Select Future Date"; Response.Write("<script>alert('Select future date');</script>"); txtDateMyLocation.Text = ""; txtDateMyLocation.Focus(); } else { lblDateMyLocation.Text = ""; } } h.Date = DateTime.Parse(txtDateMyLocation.Text); h.Time = txtTimeMyLocation.Text; BloodBL bl = new BloodBL(); int userId = int.Parse(Session[Constants.userId].ToString()); int donateResult = bl.DonateBlood(ba, userId); int hospitalResult = bl.SaveHospital(h, userId); if (donateResult + hospitalResult == 2) { string bloodPostingId = Request.QueryString[Constants.id].ToString(); bl.RemoveBloodPosting(int.Parse(bloodPostingId)); Response.Write("<script>alert('You saved a Life! Thank you...');window.location.href='HomePage.aspx';</script>"); } else { Response.Write("<script>alert('Failed to Save Blood Details...Try Again');window.location.href='DonateBlood_and_BookHospital.aspx';</script>"); } } catch (TypeInitializationException ex) { Response.Write("<script>alert('Date should be in MM/dd/yyyy format');</script>"); } catch (Exception ex) { } }
protected void GridViewBloodDonation_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Donate")) { int rowIndex = Convert.ToInt32(e.CommandArgument); int id = int.Parse(GridViewBloodNeeded.Rows[rowIndex].Cells[0].Text); BloodBL bl = new BloodBL(); Response.Redirect("DonateBlood_and_BookHospital.aspx?id=" + id, false); } }
protected void ddlArea_SelectedIndexChanged(object sender, EventArgs e) { ddlHospital.Items.Clear(); BloodBL bl = new BloodBL(); List <string> hospitals = bl.GetHospitalNameFromHospital(int.Parse(lblUserId.Text), ddlState.SelectedItem.Text, ddlArea.SelectedItem.Text); ddlHospital.DataSource = hospitals; ddlHospital.DataBind(); ddlHospital.Items.Insert(0, "Select Hospital"); }
public void TestRaiseQuery() { BloodBL bl = new BloodBL(); RaiseQuery rq = new RaiseQuery(); rq.Query = "Donate Blood"; rq.Description = "Unable to Donate Blood"; rq.Status = "In Progress"; Assert.AreEqual(1, bl.RaiseQuery(rq, 8)); }
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e) { ddlArea.Items.Clear(); BloodBL bl = new BloodBL(); List <string> areas = bl.GetAreaFromHospitalByState(int.Parse(lblUserId.Text), ddlState.SelectedItem.Text); ddlArea.DataSource = areas; ddlArea.DataBind(); ddlArea.Items.Insert(0, "Select Area"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { BloodBL bl = new BloodBL(); UserBL userBL = new UserBL(); /* * List<string> states = bl.GetAllStates(); * ddlState.DataSource = states; * ddlState.DataBind(); */ ddlState.Items.Add("Andhra Pradesh"); ddlState.Items.Insert(0, "Select State"); ddlBloodGroup.Items.Add("Select Blood Group"); ddlBloodGroup.Items.Add("A+"); ddlBloodGroup.Items.Add("A-"); ddlBloodGroup.Items.Add("B+"); ddlBloodGroup.Items.Add("B-"); ddlBloodGroup.Items.Add("O+"); ddlBloodGroup.Items.Add("O-"); ddlBloodGroup.Items.Add("AB+"); ddlBloodGroup.Items.Add("AB-"); List <string> ageList = new List <string>(); for (int i = 18; i <= 80; i++) { ageList.Add(i.ToString()); } ddlAge.DataSource = ageList; ddlAge.DataBind(); ddlAge.Items.Insert(0, "Select Age"); radioMale.Checked = true; } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } } string pwd = txtPassword.Text; txtPassword.Attributes.Add("value", pwd); }
protected void ddlAreaOtherLocation_SelectedIndexChanged(object sender, EventArgs e) { ddlHospitalOtherLocation.Items.Clear(); BloodBL bl = new BloodBL(); List <string> hospitals = bl.GetHospitalsByStateArea(ddlStateOtherLocation.SelectedItem.Text, ddlAreaOtherLocation.SelectedItem.Text); ddlHospitalOtherLocation.DataSource = hospitals; ddlHospitalOtherLocation.DataBind(); /* * ddlHospitalOtherLocation.Items.Add("Global-ANTPR"); * ddlHospitalOtherLocation.Items.Add("Global-CHTR"); * ddlHospitalOtherLocation.Items.Add("Appolo-ANTPR"); * ddlHospitalOtherLocation.Items.Add("Appolo-CHTR"); */ ddlHospitalOtherLocation.Items.Insert(0, "Select Hospital"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { if (Session[Constants.userId].ToString() != null || Session[Constants.userId].ToString() != "") { lblUserId.Text = Session[Constants.userId].ToString(); } else { throw new NullReferenceException(); } lblUserId.Visible = false; bloodGroupDropDownList.Items.Add("Select"); bloodGroupDropDownList.Items.Add("A+"); bloodGroupDropDownList.Items.Add("A-"); bloodGroupDropDownList.Items.Add("B+"); bloodGroupDropDownList.Items.Add("B-"); bloodGroupDropDownList.Items.Add("O+"); bloodGroupDropDownList.Items.Add("O-"); bloodGroupDropDownList.Items.Add("AB+"); bloodGroupDropDownList.Items.Add("AB-"); BloodBL bl = new BloodBL(); /* * List<string> states = bl.GetAllStates(); * stateDropDownList.DataSource = states; * stateDropDownList.DataBind(); */ stateDropDownList.Items.Add("Andhra Pradesh"); stateDropDownList.Items.Insert(0, "Select State"); searchResultsLabel.Text = ""; bloodRequirementsButton.Visible = false; } catch (Exception ex) { Response.Write("<script>alert('Your session expired...Please login again');window.location.href='HomePageBeforeLogin.aspx'</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session[Constants.userId].ToString() != null || Session[Constants.userId].ToString() != "") { lblUserId.Text = Session[Constants.userId].ToString(); } lblUserId.Visible = false; Session[Constants.userId] = lblUserId.Text; string bloodPostingId = Request.QueryString[Constants.id].ToString(); Session["bloodPostingId"] = bloodPostingId; BloodBL bl = new BloodBL(); UserBL userBL = new UserBL(); if (int.Parse(bloodPostingId) != 0) { BloodPosting bp = bl.GetBloodPosting(int.Parse(bloodPostingId)); User userDetails = userBL.GetUser(Session[Constants.userEmail].ToString()); if (!bp.BloodGroup.Equals(userDetails.BloodGroup)) { Response.Write("<script>alert('Posted Blood not matched with your Blood. Please Choose other to Donate Blood');window.location.href='HomePage.aspx'</script>"); } } panelMyLocation.Visible = false; panelOtherLocation.Visible = false; /* * List<string> states = bl.GetAllStates(); * ddlStateOtherLocation.DataSource = states; * ddlStateOtherLocation.DataBind(); */ ddlStateOtherLocation.Items.Add("Andhra Pradesh"); ddlStateOtherLocation.Items.Insert(0, "Select State"); } catch (Exception ex) { Response.Write("<script>alert('Your session expired...Please login again');window.location.href='HomePageBeforeLogin.aspx'</script>"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { BloodPosting blood = new BloodPosting(); blood.State = ddlState.SelectedValue.ToString(); blood.Area = ddlArea.SelectedValue.ToString(); blood.Pincode = int.Parse(txtPincode.Text.ToString()); blood.BloodGroup = ddlBloodGroup.SelectedValue.ToString(); blood.ContactNumber = long.Parse(txtPhnNumber.Text.ToString()); BloodBL bl = new BloodBL(); int result = bl.PostBlood(blood, int.Parse(lblUserId.Text)); if (result == 1) { Response.Write("<script>alert('Your blood details posted successfully');window.location.href='HomePage.aspx'</script>"); } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } }
protected void ResolvedButtonActive(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Resolved")) { int rowIndex = Convert.ToInt32(e.CommandArgument); int id = int.Parse(GridViewResolveQueries.Rows[rowIndex].Cells[0].Text); BloodBL bl = new BloodBL(); string solution1 = GridViewResolveQueries.Rows[rowIndex].Cells[4].Text; TextBox solutionTextBox = (TextBox)GridViewResolveQueries.FindControl("txtSolution"); //Response.Write("<script>alert('"+solution1+"');</script>"); //Response.Write("<script>alert('" + solutionTextBox.Text + "');</script>"); //if (bl.UpdateQuery("Resolved", solution1, id) == 1) if (bl.UpdateQuery("Resolved", "yet to solve", id) == 1) { Response.Write("<script>alert('Query Updated Successfully');</script>"); } else { Response.Write("<script>alert('Error in Query Updating');</script>"); } DisplayQueries(); } }
public void TestGetHospitalByStateArea() { BloodBL bl = new BloodBL(); Assert.AreEqual(2, bl.GetHospitalsByStateArea("Andhra Pradesh", "Anantapur").Count); }
public void TestRemoveBloodPosting() { BloodBL bl = new BloodBL(); Assert.AreEqual(1, bl.RemoveBloodPosting(5)); }