protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string CS = ConfigurationManager.ConnectionStrings["bloodbankConnectionString"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    con.Open();
                    donors d = new donors();

                    d.d_id = Convert.ToInt32(deltxt.Text);
                    SqlCommand cmd = new SqlCommand("delete from comments where comment_id=" + d.d_id + "or comment_fk_fromprofileid=" + d.d_id + " or comment_fk_onprofileid=" + d.d_id, con);
                    cmd.ExecuteNonQuery();

                    SqlCommand cmd1 = new SqlCommand("delete from donor_img where img_fk_donor=" + d.d_id, con);
                    cmd1.ExecuteNonQuery();

                    SqlCommand cmd2 = new SqlCommand("delete from user_donor where d_id=" + d.d_id, con);
                    cmd2.ExecuteNonQuery();


                    con.Close();
                }

                Response.Redirect("~/views/delete.aspx");
            }
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         donors d = new donors();
         d.d_email    = txtemail.Text;
         d.d_password = txtpassword.Text;
         d.d_cnic     = txtcnic.Text;
         d.d_name     = txtname.Text;
         d.d_age      = Convert.ToInt32(DropDownList3.SelectedValue);
         d.d_hosp_id  = Convert.ToInt32(DropDownList2.SelectedValue);
         d.d_contact  = txtcontact.Text;
         d.d_bgroup   = DropDownList2.SelectedValue.ToString();
         insert i   = new insert();
         string msg = i.insert_donor(d);
         if (msg == "-1")
         {
         }
         else
         {
             Session["u_id"] = msg;
             Response.Redirect("~/views/profile.aspx");
         }
     }
 }
Beispiel #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string CS = ConfigurationManager.ConnectionStrings["bloodbankConnectionString"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    con.Open();
                    donors d = new donors();

                    d.d_id = Convert.ToInt32(txtid.Text);



                    SqlCommand cmd1 = new SqlCommand("insert into bloodbottle select d_blood,d_id from user_donor where d_id=" + d.d_id, con);
                    cmd1.ExecuteNonQuery();

                    SqlCommand cmd2 = new SqlCommand("update user_donor set d_status = 1 where d_id=" + d.d_id, con);
                    cmd2.ExecuteNonQuery();
                    con.Close();
                    Response.Write("<script>alert('Blood Donated') </script>");
                }

                Response.Redirect("~/views/donorAdd.aspx");
            }
        }
Beispiel #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                donors d = new donors();
                d.d_email    = txtemail.Text;
                d.d_password = txtcpassword.Text;
                d.d_cinc     = txtcnic.Text;
                d.d_name     = txtname.Text;
                d.d_age      = Convert.ToInt32(DropDownList3.SelectedValue);

                d.d_contact = TXTCONTCT.Text;
                d.d_hb      = (float)Convert.ToDouble(txthb.Text);
                d.d_sex     = DropDownList5.Text;
                d.d_bgroup  = DropDownList1.SelectedValue.ToString();
                d.d_status  = Convert.ToString(0);
                insert i   = new insert();
                string msg = i.insert_donor(d);
                if (msg == "-1")
                {
                    Label1.Text = "some error";
                }
                else
                {
                    HttpCookie cookie = new HttpCookie("DONOR");
                    cookie["email"] = Server.UrlEncode(txtemail.Text);
                    cookie["pwd"]   = Server.UrlEncode(txtcpassword.Text);
                    cookie.Expires  = DateTime.Now.AddDays(30);
                    Response.Cookies.Add(cookie);
                    Session["u_id"] = msg;
                    Response.Redirect("~/views/profile.aspx");
                }
            }
        }
Beispiel #5
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         donors d = new donors();
         d.d_email    = txtemail.Text;
         d.d_password = txtpass.Text;
         d.d_cinc     = txtcnic.Text;
         d.d_name     = txtname.Text;
         d.d_age      = Convert.ToInt32(DropDownList1.SelectedValue);
         d.d_contact  = txtcontact.Text;
         d.d_bgroup   = DropDownList2.SelectedValue.ToString();
         d.d_hb       = (float)Convert.ToDouble(txthb.Text);
         string CS = ConfigurationManager.ConnectionStrings["bloodbankConnectionString"].ConnectionString;
         using (SqlConnection con = new SqlConnection(CS))
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("update user_donor set  d_email = '" + d.d_email + "', d_password ='******',d_cnic =" + d.d_cinc + ",d_name = '" + d.d_name + "',d_age = " + d.d_age + ",d_contact = " + d.d_contact + ",d_blood = " + d.d_bgroup + ", d_hb=" + d.d_hb + " where d_id = " + Session["u_id"], con);
             cmd.ExecuteNonQuery();
             con.Close();
             Response.Redirect("~/views/profile.aspx");
         }
     }
 }
Beispiel #6
0
 public int Delete(donors existingdonors)
 {
     return(AllocateRepo().Delete(existingdonors));
 }
Beispiel #7
0
 public int Update(donors existingdonors)
 {
     return(AllocateRepo().Update(existingdonors));
 }
Beispiel #8
0
 public long Create(donors newdonors)
 {
     return(AllocateRepo().Create(newdonors));
 }