Esempio n. 1
0
    protected void sign_in_btn_ServerClick(object sender, EventArgs e)
    {
        try
        {

            user_infoBO user_creadentails = new user_infoBO();
            UserFunctionsBAL usersignin = new UserFunctionsBAL();
            user_creadentails.email_id = txtEmail.Value.ToString();
            user_creadentails.password = txtPassword.Value.ToString();

            if (usersignin.UserSigIn(user_creadentails))
            {
                Session["user_id"] = Convert.ToInt32(usersignin.UserIdFetch(user_creadentails.email_id));
                Response.Redirect("~/UserProfile.aspx");
            }
            else
            {
                lblErrorMessage.Text = "Username Or Password Incorrect...!";
            }

        }
        catch (Exception ex)
        {
            Response.Write("<script type='text/javascript'> $(function(){alert('Some Error Occured \n Please try again later')}); </script>");
        }
    }
Esempio n. 2
0
    protected void sign_in_btn_ServerClick(object sender, EventArgs e)
    {
        try
        {
            user_infoBO      user_creadentails = new user_infoBO();
            UserFunctionsBAL usersignin        = new UserFunctionsBAL();
            user_creadentails.email_id = txtEmail.Value.ToString();
            user_creadentails.password = txtPassword.Value.ToString();

            if (usersignin.UserSigIn(user_creadentails))
            {
                Session["user_id"] = Convert.ToInt32(usersignin.UserIdFetch(user_creadentails.email_id));

                Response.Redirect("~/UserProfileHome.aspx");
            }
            else
            {
                lblErrorMessage.Text = "Username Or Password Incorrect...!";
            }
        }
        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("SignIn.aspx", ex.ToString());
            Response.Write("<script type='text/javascript'> $(function(){alert('Some Error Occured \n Please try again later')}); </script>");
        }
    }
    //fetching all user info from the database (developer :HawK)

    public DataTable getAllUserInfo_dal(user_infoBO userinfoBO_BO)
    {
        try
        {
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            DataTable dt    = new DataTable();
            String    query = "Select * from user_info where user_id=" + userinfoBO_BO.user_id + "";
            adapter = new SqlDataAdapter(query, newcon);
            adapter.Fill(dt);

            return(dt);
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
    public bool PasswordMatch(user_infoBO password_user_info)

    {
        String pass        = "";
        String user_id     = password_user_info.user_id.ToString();
        String oldpassword = password_user_info.password;

        try
        {
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }


            String query = "Select password from user_info where user_id = @uid";
            command = new SqlCommand(query, newcon);
            command.Parameters.AddWithValue("@uid", user_id);

            reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Read();
                {
                    pass = reader[0].ToString();
                }
            }
            else
            {
                pass = "";
            }

            command.Dispose();
            reader.Dispose();


            if (pass == oldpassword)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }

        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
    //protected void EnableTb_Click(object sender, EventArgs e)
    //{
    //    tbUserPassword.ReadOnly = false;
    //    tbNewPassword.ReadOnly = false;

    //}
    protected void UpdateData_Click(object sender, EventArgs e)
    {
        try
        {
            user_infoBO      ubo  = new user_infoBO();
            UserFunctionsBAL ubal = new UserFunctionsBAL();

            string filename = "";
            ubo.user_id    = Convert.ToInt32(Session["user_id"]);
            ubo.first_name = tbUserFirstName.Value;
            ubo.last_name  = tbUserLastName.Value;
            ubo.city       = tbUserCity.Value;
            ubo.country    = tbUserCountry.Value;

            if (tbUserPassword.Value.Trim() != "" && tbNewPassword.Value.Trim() != "")
            {
                ubo.password = tbUserPassword.Value;
                if (ubal.PasswordMatch(ubo))
                {
                    ubo.password    = tbNewPassword.Value;
                    filename        = ImgUpload();
                    ubo.profile_pic = "/Images/userprofilepic/" + filename;
                    ubal.ProfileUpdate(ubo);
                    StatusLabel.Text = "Profile Successfuly updated";
                }
                else
                {
                    StatusLabel.Text = "old password not match";
                }
            }
            else
            {
                if (ImgUpload() == null)
                {
                    StatusLabel.Text = "image is not valid";
                }
                else
                {
                    filename        = ImgUpload();
                    ubo.profile_pic = "/Images/userprofilepic/" + filename;

                    ubo.password = ubal.getPassword(ubo);
                    ubal.ProfileUpdate(ubo);
                    StatusLabel.Text = "Profile Successfuly updated";
                }
            }


            Response.Redirect("~/UserProfileEdit.aspx");
        }

        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("UserProfileEdit.aspx", ex.ToString());
            Response.Write("<script>alert('Some Error Occured \n Sorry for inconvenience');</script>");
        }
    }
    public bool UserSignUp(user_infoBO social_login_info)
    {
        try
        {
            if (check_emailId(social_login_info.email_id.ToString()))
            {
                return(true);
            }
            else
            {
                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                int social = social_login_info.social == true ? 1 : 0;        //getting the bit value for social field in db

                social_login_info.user_id = newid.incrementer("user_id", "user_info");



                social_login_info.join_date = System.DateTime.Now;
                String query = "Insert into user_info(user_id,email_id,first_name,join_date,social_type,social,profile_pic) values(@user_id,@email_id,@first_name,@join_date,@social_type,@social,@profile_pic)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", social_login_info.user_id);
                command.Parameters.AddWithValue("@email_id", social_login_info.email_id);
                command.Parameters.AddWithValue("@first_name", social_login_info.first_name);
                command.Parameters.AddWithValue("@social_type", social_login_info.social_type);
                command.Parameters.AddWithValue("@social", social);
                command.Parameters.AddWithValue("@profile_pic", social_login_info.profile_pic);


                command.Parameters.AddWithValue("@join_date", social_login_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return(true);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Esempio n. 7
0
//signup from sn
    public bool UserSignUp(user_infoBO social_user_info)
    {
        try
        {
            return(userFunctions.UserSignUp(social_user_info));
        }
        catch
        {
            throw;
        }
    }
Esempio n. 8
0
 public bool UserSigIn(user_infoBO user_credentials)
 {
     try
     {
         return(userFunctions.UserSignIn(user_credentials));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 9
0
 public bool PasswordMatch(user_infoBO password_user_info)
 {
     try
     {
         return(userFunctions.PasswordMatch(password_user_info));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 10
0
 public string ProfileUpdate(user_infoBO uinfo)
 {
     try
     {
         return(userFunctions.ProfileUpdate(uinfo));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 11
0
 public string getPassword(user_infoBO uinfo)
 {
     try
     {
         return(userFunctions.getPassword(uinfo));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 12
0
    protected void bntJoinMe_Click(object sender, EventArgs e)
    {
        try
        {
            UserFunctionsBAL registeruser = new UserFunctionsBAL();

            user_infoBO user_info = new user_infoBO();

            String email_id = user_info.email_id = txtEmail.Value.ToString();
            user_info.first_name = txtFname.Value.ToString();
            user_info.last_name  = txtLname.Value.ToString();
            user_info.country    = ListCountry.SelectedValue.ToString();
            user_info.city       = StateLoad.SelectedValue.ToString();
            user_info.password   = txtPassword.Value.ToString();
            if (rdoBlogger.Checked == true)
            {
                user_info.user_type = 1;
            }
            else
            {
                user_info.user_type = 0;
            }

            int check = registeruser.NewUserRegister(user_info);

            if (check == 1)
            {
                Response.Write("<script type='text/javascript'> alert('Email ID Already Registered ... !') </script>");
            }
            else if (check == 2)
            {
                //Response.Write("<script>alert('Thanks For Joining Us ... !'); </script>");
                registeruser.JoinUsMail(email_id);

                String okmessage = "<script type='text/javascript'>  alert('Thank You For Joining Us'); </script>";

                Page.ClientScript.RegisterStartupScript(this.GetType(), "okmessage", okmessage);

                //Response.Redirect("~/sign_in.aspx");
            }

            txtEmail.Value       = "";
            txtFname.Value       = "";
            txtLname.Value       = "";
            rdoBlogger.Checked   = false;
            rdoVolunteer.Checked = false;
        }
        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("JoinUs.aspx", ex.ToString());
            Response.Write("<script>alert('Some Error Occured \n Sorry for inconvenience');</script>");
        }
    }
Esempio n. 13
0
 public bool user_info_insert(user_infoBO u_infobo)
 {
     try
     {
         return(u_infoDAL.user_info_insert(u_infobo));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 14
0
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {
            return(userFunctions.NewUserRegister(user_info));
        }

        catch
        {
            throw;
        }
    }
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {
            if (!(check_emailId(user_info.email_id)))
            {
                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                user_info.user_id = newid.incrementer("user_id", "user_info");

                user_info.join_date = System.DateTime.Now;

                String query = "Insert into user_info(user_id,email_id,first_name,last_name,password,country,join_date) values(@user_id,@email_id,@first_name,@last_name,@password,@country,@join_date)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", user_info.user_id);
                command.Parameters.AddWithValue("@email_id", user_info.email_id);
                command.Parameters.AddWithValue("@first_name", user_info.first_name);
                command.Parameters.AddWithValue("@last_name", user_info.last_name);
                command.Parameters.AddWithValue("@password", user_info.password);
                //command.Parameters.AddWithValue("@user_type",user_info.user_type);
                command.Parameters.AddWithValue("@country", user_info.country);
                //command.Parameters.AddWithValue("@city", user_info.city);
                command.Parameters.AddWithValue("@join_date", user_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return(2);
            }
            else
            {
                return(1);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Esempio n. 16
0
    public DataTable view_users(user_infoBO ubo)
    {
        user_infoDAL uDAL = new user_infoDAL();

        try
        {
            return(uDAL.view_users(ubo));
        }
        catch (Exception)
        {
            throw;
        }
        finally { uDAL = null; }
    }
Esempio n. 17
0
    public void delete_users(user_infoBO ubo)
    {
        user_infoDAL uDAL = new user_infoDAL();

        try
        {
            uDAL.delete_user(ubo);
        }
        catch (Exception)
        {
            throw;
        }
        finally { uDAL = null; }
    }
Esempio n. 18
0
    protected void bntJoinMe_Click(object sender, EventArgs e)
    {
        try
        {

            UserFunctionsBAL registeruser = new UserFunctionsBAL();

            user_infoBO user_info = new user_infoBO();

            String email_id = user_info.email_id = txtEmail.Value.ToString();
            user_info.first_name = txtFname.Value.ToString();
            user_info.last_name = txtLname.Value.ToString();
            user_info.country = sltCountry.Value.ToString();
            user_info.city = sltCity.Value.ToString();
            user_info.password = txtPassword.Value.ToString();
            if (rdoBlogger.Checked == true)
            {
                user_info.user_type = true;
            }
            else
            {
                user_info.user_type = false;
            }

            int check = registeruser.NewUserRegister(user_info);

            if ( check == 1)
            {
                Response.Write("<script type='text/javascript'> alert('Email ID Already Registered ... !') </script>");
            }
            else if (check == 2)
            {
                //Response.Write("<script>alert('Thanks For Joining Us ... !'); </script>");
                registeruser.JoinUsMail(email_id);

                Response.Redirect("~/HopeInTomorrow/sign_in.aspx");
            }

            txtEmail.Value = "";
            txtFname.Value = "";
            txtLname.Value = "";
            rdoBlogger.Checked = false;
            rdoVolunteer.Checked = false;
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Esempio n. 19
0
    protected void view_users(int x)
    {
        user_infoBAL uBAL = new user_infoBAL();
        user_infoBO  uBO  = new user_infoBO();

        uBO.user_type = x;

        try
        {
            DataTable dt = uBAL.view_users(uBO);

            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Esempio n. 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string  socialType  = Request["socialType"];
        string  txtEmail    = Request["email"];
        string  name        = Request["name"];
        Boolean social      = Request["social"].ToString() == "yes" ? true : false;
        string  profile_pic = Request["image"];

        Response.Write(socialType + txtEmail + name + social + profile_pic);



        try
        {
            user_infoBO      social_login_info = new user_infoBO();
            UserFunctionsBAL usersignup        = new UserFunctionsBAL();
            social_login_info.email_id    = txtEmail;
            social_login_info.first_name  = name;
            social_login_info.social_type = socialType;
            social_login_info.social      = social;
            social_login_info.profile_pic = profile_pic;

            if (usersignup.UserSignUp(social_login_info))
            {
                Session["user_id"]           = Convert.ToInt32(usersignup.UserIdFetch(social_login_info.email_id));
                Session["user_login_social"] = "yes";
                Session["user_login_type"]   = socialType;
                Session["user_pp"]           = profile_pic;
                //Response.Write(Session["user_pp"].ToString());
                Response.Redirect("~/UserProfileHome.aspx");
            }
            //else
            //{
            //    lblErrorMessage.Text = "Username Or Password Incorrect...!";
            //}
        }
        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("SocialLogin.aspx", ex.ToString());
            Response.Write("<script type='text/javascript'> alert('Some Error Occured \n Please try again later'); </script>");
        }
    }
    public int UserIDFetch(String user_emial)
    {
        try
        {
            user_infoBO user_info = new user_infoBO();
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }
            query = "Select user_id from user_info where email_id=@email";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", user_emial.ToString());


            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)
            {
                reader.Read();

                user_info.user_id = Convert.ToInt32(reader[0]);
            }

            return(user_info.user_id);
        }

        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
Esempio n. 22
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        user_infoBAL uBAL = new user_infoBAL();
        user_infoBO  uBO  = new user_infoBO();
        TableCell    cell = GridView1.Rows[e.RowIndex].Cells[1];
        string       abc  = cell.Text;

        uBO.user_id = Convert.ToInt32(abc);


        try
        {
            uBAL.delete_users(uBO);
            Response.Write("<script>alert('Data deleted successfully " + abc + "');</script>");

            view_users(0);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Esempio n. 23
0
 public bool user_info_insert(user_infoBO u_infbo)
 {
     try
     {
         query = "insert into user_info values(@user_id,@email_id,@first_name,@last_name,@password,@user_type,@country,@city,@join_date,@profile_pic_name)";
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd = new SqlCommand(query, con);
         cmd.Parameters.AddWithValue("@user_id", u_infbo.user_id);
         cmd.Parameters.AddWithValue("@email_id", u_infbo.email_id);
         cmd.Parameters.AddWithValue("@first_name", u_infbo.first_name);
         cmd.Parameters.AddWithValue("@last_name", u_infbo.last_name);
         cmd.Parameters.AddWithValue("@password", u_infbo.password);
         cmd.Parameters.AddWithValue("@user_type", u_infbo.user_type);
         cmd.Parameters.AddWithValue("@country", u_infbo.country);
         cmd.Parameters.AddWithValue("@city", u_infbo.city);
         cmd.Parameters.AddWithValue("@join_date", u_infbo.join_date);
         cmd.Parameters.AddWithValue("@profile_pic_name", u_infbo.profile_pic);
         if (cmd.ExecuteNonQuery() >= 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Esempio n. 24
0
 public DataTable view_users(user_infoBO ubo)
 {
     try
     {
         string user_type = Convert.ToString(ubo.user_type);
         if (user_type == "1" || user_type == "0")
         {
             query = "select user_id,email_id,first_name,last_name,user_type,country,city,join_date,profile_pic_name from user_info where user_type=" + user_type + "";
             con.Open();
             cmd  = new SqlCommand(query, con);
             da   = new SqlDataAdapter(cmd);
             dSet = new DataSet();
             da.Fill(dSet, "user_info");
             return(dSet.Tables["user_info"]);
         }
         else
         {
             query = "select user_id,email_id,first_name,last_name,user_type,country,city,join_date,profile_pic_name from user_info";
             con.Open();
             cmd  = new SqlCommand(query, con);
             da   = new SqlDataAdapter(cmd);
             dSet = new DataSet();
             da.Fill(dSet, "user_info");
             return(dSet.Tables["user_info"]);
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         dSet.Dispose();
         da.Dispose();
         con.Close();
         con.Dispose();
     }
 }
    protected void load_default_user_value()
    {
        try
        {
            user_infoBO      ubo  = new user_infoBO();
            UserFunctionsBAL ubal = new UserFunctionsBAL();
            ubo.user_id = Convert.ToInt32(Session["user_id"]);
            DataTable dt = new DataTable();
            dt = ubal.getAllUserInfo_bal(ubo);
            DataView dv = dt.DefaultView;
            tbUserFirstName.Value = Convert.ToString(dv[0]["first_name"]);
            tbUserLastName.Value  = Convert.ToString(dv[0]["last_name"]);
            tbUserCity.Value      = Convert.ToString(dv[0]["city"]);
            tbUserCountry.Value   = Convert.ToString(dv[0]["country"]);
        }

        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("UserProfileEdit.aspx", ex.ToString());
            Response.Write("<script>alert('Some Error Occured \n Sorry for inconvenience');</script>");
        }
    }
Esempio n. 26
0
 public void delete_user(user_infoBO ubo)
 {
     try
     {
         query = "delete  from user_info where user_id=@user_id";
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd = new SqlCommand(query, con);
         cmd.Parameters.AddWithValue("@user_id", ubo.user_id);
         cmd.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         con.Close();
         con.Dispose();
     }
 }
    public bool UserSignIn(user_infoBO user_credentials)
    {
        try
        {
            newcon.Open();
            query = "Select user_id from user_info where email_id=@email and password=@pass and conf=1";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", user_credentials.email_id.ToString());
            command.Parameters.AddWithValue("@pass", user_credentials.password.ToString());

            reader = command.ExecuteReader();

            command.Dispose();


            if (reader.HasRows)  //username or password is correct
            {
                return(true);
            }
            else
            {
                return(false);              //Username or password not correct
            }
        }
        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
    /*profile update */
    public string ProfileUpdate(user_infoBO user_info)
    {
        try
        {
            String query = "UPDATE user_info SET ";
            int    f     = 0;

            if (user_info.first_name != null)
            {
                if (f == 1)
                {
                    query += ",";
                }
                query += ("first_name='" + user_info.first_name + "'");

                f = 1;
            }

            if (user_info.last_name != null)
            {
                if (f == 1)
                {
                    query += ",";
                }
                query += ("last_name='" + user_info.last_name + "'");
                f      = 1;
            }
            if (user_info.password != null)
            {
                if (f == 1)
                {
                    query += ",";
                }
                query += ("password='******'");
                f      = 1;
            }
            if (user_info.country != null)
            {
                if (f == 1)
                {
                    query += ",";
                }
                query += ("country='" + user_info.country + "'");

                f = 1;
            }
            if (user_info.profile_pic != null)
            {
                if (f == 1)
                {
                    query += ",";
                }
                query += ("profile_pic='" + user_info.profile_pic + "'");
                f      = 1;
            }

            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }
            query += " where user_id=@user_id";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@user_id", user_info.user_id);

            command.ExecuteNonQuery();
            command.Dispose();

            return("profile Successfully updated");
        }


        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Esempio n. 29
0
 public bool UserSigIn(user_infoBO user_credentials)
 {
     try
     {
         return userFunctions.UserSignIn(user_credentials);
     }
     catch
     {
         throw;
     }
 }
Esempio n. 30
0
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {

            return userFunctions.NewUserRegister(user_info);
        }

        catch
        {
            throw;
        }
    }
Esempio n. 31
0
    public bool UserSignIn(user_infoBO user_credentials )
    {
        try
        {
            newcon.Open();
            query = "Select user_id from user_info where email_id=@email and password=@pass";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", user_credentials.email_id.ToString());
            command.Parameters.AddWithValue("@pass", user_credentials.password.ToString());

            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)  //username or password is correct
            {
                return true;
            }
            else
            {
                return false;              //Username or password not correct
            }

        }
        catch
        {
            throw;

        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
Esempio n. 32
0
    public int UserIDFetch(String user_emial)
    {
        try
        {
            user_infoBO user_info = new user_infoBO();
            if (newcon.State == ConnectionState.Closed)
            {

                newcon.Open();
            }
            query = "Select user_id from user_info where email_id=@email";

            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@email", user_emial.ToString());

            reader = command.ExecuteReader();

            command.Dispose();

            if (reader.HasRows)
            {

                reader.Read();

                user_info.user_id = Convert.ToInt32(reader[0]);

            }

            return user_info.user_id;

        }

        catch
        {
            throw;
        }

        finally
        {
            reader.Dispose();
            newcon.Close();
        }
    }
Esempio n. 33
0
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {

            if (!(check_emailId(user_info.email_id)))
            {

                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                user_info.user_id = newid.incrementer("user_id", "user_info");

                user_info.join_date = System.DateTime.Now;

                int x = 0;

                if (user_info.user_type == true)
                {
                    x = 1;
                }

                String query = "Insert into user_info(user_id,email_id,first_name,last_name,password,user_type,country,city,join_date) values(@user_id,@email_id,@first_name,@last_name,@password,@user_type,@country,@city,@join_date)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", user_info.user_id);
                command.Parameters.AddWithValue("@email_id", user_info.email_id);
                command.Parameters.AddWithValue("@first_name", user_info.first_name);
                command.Parameters.AddWithValue("@last_name", user_info.last_name);
                command.Parameters.AddWithValue("@password", user_info.password);
                command.Parameters.AddWithValue("@user_type", x);
                command.Parameters.AddWithValue("@country", user_info.country);
                command.Parameters.AddWithValue("@city", user_info.city);
                command.Parameters.AddWithValue("@join_date", user_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return 2;
            }
            else
            {
               return 1;
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Esempio n. 34
0
    //fetching all user info from the database (developer :HawK)

    public DataTable getAllUserInfo_bal(user_infoBO userinfoBO_BO)
    {
        return(userFunctions.getAllUserInfo_dal(userinfoBO_BO));
    }