Beispiel #1
0
        public Int32 insrt_usr(clsusr usr)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("sp_insrtreg", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@p_name", SqlDbType.VarChar, 50).Value     = usr.p_name;
            cmd.Parameters.Add("@p_bloodgrp", SqlDbType.VarChar, 50).Value = usr.p_bloodgrp;
            cmd.Parameters.Add("@p_gender", SqlDbType.VarChar, 50).Value   = usr.p_gender;
            cmd.Parameters.Add("@p_dob", SqlDbType.VarChar, 50).Value      = usr.p_dob;
            cmd.Parameters.Add("@p_mobile", SqlDbType.VarChar, 50).Value   = usr.p_mobile;
            cmd.Parameters.Add("@p_landline", SqlDbType.VarChar, 50).Value = usr.p_landline;
            cmd.Parameters.Add("@p_state", SqlDbType.VarChar, 50).Value    = usr.p_state;
            cmd.Parameters.Add("@p_city", SqlDbType.VarChar, 50).Value     = usr.p_city;
            cmd.Parameters.Add("@p_email", SqlDbType.VarChar, 50).Value    = usr.p_email;
            cmd.Parameters.Add("@p_address", SqlDbType.VarChar, 50).Value  = usr.p_address;
            Int32 i = cmd.ExecuteNonQuery();

            cmd.Dispose();
            con.Close();
            return(i);
        }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        clsusr objusr = new clsusr();
        clsprp objprp = new clsprp();

        clsusr1 objusr1 = new clsusr1();
        clsprp1 objprp1 = new clsprp1();

        objusr.p_name = txtname.Text;
        objusr.p_bloodgrp = drpbldgrp.Text;
        objusr.p_gender = drpgndr.Text;
        objusr.p_dob = txtdob.Text;
        objusr.p_mobile = txtmob.Text;
        objusr.p_landline = txtland.Text;
        objusr.p_state = drpstate.Text;
        objusr.p_city = drpcity.Text;
        objusr.p_email = txtemail.Text;
        objusr.p_address = txtadd.Text;

        objusr1.p_username = txtusr.Text;
        objusr1.p_password = txtpass.Text;

        Int32 i = objprp.insrt_usr(objusr);
        if (i > 0)
        {
            comment.Text = "registered";

        }
        else
        {
            comment.Text = "not registered";
        }

        Int32 j = objprp1.insrt_usr(objusr1);
        if (j > 0)
        {
            comment.Text = "registered";

        }
        else
        {
            comment.Text = "not registered";
        }
        Response.Redirect("donorlog.aspx");
    }
 public Int32 insrt_usr(clsusr usr)
 {
     if (con.State == ConnectionState.Closed)
     {
         con.Open();
     }
     SqlCommand cmd = new SqlCommand("sp_insrtreg", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("@p_name", SqlDbType.VarChar, 50).Value = usr.p_name;
     cmd.Parameters.Add("@p_bloodgrp", SqlDbType.VarChar,50).Value = usr.p_bloodgrp;
     cmd.Parameters.Add("@p_gender", SqlDbType.VarChar,50).Value = usr.p_gender;
     cmd.Parameters.Add("@p_dob", SqlDbType.VarChar,50).Value = usr.p_dob;
     cmd.Parameters.Add("@p_mobile", SqlDbType.VarChar, 50).Value = usr.p_mobile;
     cmd.Parameters.Add("@p_landline", SqlDbType.VarChar, 50).Value = usr.p_landline;
     cmd.Parameters.Add("@p_state", SqlDbType.VarChar, 50).Value = usr.p_state;
     cmd.Parameters.Add("@p_city", SqlDbType.VarChar, 50).Value = usr.p_city;
     cmd.Parameters.Add("@p_email", SqlDbType.VarChar, 50).Value = usr.p_email;
     cmd.Parameters.Add("@p_address", SqlDbType.VarChar, 50).Value = usr.p_address;
     Int32 i = cmd.ExecuteNonQuery();
     cmd.Dispose();
     con.Close();
     return i;
 }