Exemplo n.º 1
0
    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>");
            }
        }
    }
        public void TestGetBloodPosting()
        {
            BloodBL bl = new BloodBL();

            Assert.AreEqual(5, bl.GetBloodPosting(5).Id);
        }