protected void btnSignup_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)// if page has not any error message then page.isvalid return the true
     {
         if (email.Text != "" && password.Text != "" && firstName.Text != "" && lastName.Text != "")
         {
             if (Session["userEmail"] == null)
             {
                 Session["userEmail"] = email.Text;
                 //here we will add first name and last name and put into username.
                 userMasterBO.firstName = firstName.Text;
                 userMasterBO.lastName  = lastName.Text;
                 Session["fName"]       = userMasterBO.firstName;
                 Session["socialType"]  = "local";
                 Session["socialOrNot"] = 0;     //HERE 0 MEANS LOCAL USER.
                 //give code for insert
                 //give the code to insert data into the usermaster table.
                 userMasterBO.email         = Session["userEmail"].ToString();
                 userMasterBO.password      = password.Text;
                 userMasterBO.middleName    = "";
                 userMasterBO.socialNetwork = false; //false for local user and true for any user from social network
                 userMasterBO.status        = true;
                 userMasterBO.roleId        = 3;     //3 for user , 2 for mp,1 for admin, 4  for moderator
                 // userMasterBO.snTypeId = 0;
                 userMasterBO.profilePicPath = "";
                 HiddenField1.Value          = userMasterBAL.insertUser(userMasterBO);
                 if (HiddenField1.Value == "User Successfully Created.")
                 {
                     Session["guid"] = (userMasterBAL.getGuid(userMasterBO)).ToString();
                     ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "userCreated()", true);
                     // Response.Redirect("test.aspx", true);
                 }
                 else if (HiddenField1.Value == "User Already Exists.")
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "userNotCreated()", true);
                 }
                 else if (HiddenField1.Value == "User Updated.")
                 {
                     Session["guid"] = (userMasterBAL.getGuid(userMasterBO)).ToString();
                     ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "userUpdated()", true);
                 }
             }
             else
             {
             }
         }
     }
 }
Exemple #2
0
    private bool userCreateAndSession()
    {  //+ email + "&name=" + name + "&social=" + social + "&socialType=" + socialtype + "&image=" + picture
        if (Request["email"] != null && Request["name"] != null && Request["social"] != null && Request["socialType"] != null && Request["image"] != null)
        {
            String QEmail      = Request["email"];
            String Qname       = Request["name"];
            String Qsocial     = Request["social"];
            String QsocialType = Request["socialType"];
            String Qpicture    = Request["image"];

            String[]      SplitName     = new String[3];
            userMasterBO  userMasterBO  = new userMasterBO();
            userMasterBAL userMasterBAL = new userMasterBAL();



            SplitName = Qname.Split(' ');


            //give the code to insert data into the usermaster table.
            userMasterBO.email      = QEmail;
            userMasterBO.firstName  = SplitName[0];
            userMasterBO.lastName   = (SplitName.Count() > 1) ? SplitName[1] : "NULL";
            userMasterBO.middleName = (SplitName.Count() > 2) ? SplitName[2] : "NULL";
            userMasterBO.password   = "";

            userMasterBO.socialNetwork  = true;
            userMasterBO.status         = true;
            userMasterBO.roleId         = 3;                                             //3 for user , 2 for mp,1 for admin, 4  for moderator
            userMasterBO.snTypeId       = userMasterBAL.getSocialNetworkId(QsocialType); //fetch the corresponding id of socialnetwork
            userMasterBO.profilePicPath = (Qpicture.Length > 1) ? Qpicture : "NULL";
            //insert data into the database.
            string msg = userMasterBAL.insertUser(userMasterBO).ToString();
            userMasterBO.guid = Convert.ToInt64(userMasterBAL.getGuid(userMasterBO));
            guId  = userMasterBO.guid;
            name  = userMasterBO.firstName;
            Email = userMasterBO.email;
            CreateSession();
            return(true);
        }


        else
        {
            return(false);
        }
    }
    private bool userCreateAndSession()
    {
        //+ email + "&name=" + name + "&social=" + social + "&socialType=" + socialtype + "&image=" + picture

        if (Request["email"] != null && Request["name"] != null && Request["social"] != null && Request["socialType"] != null && Request["image"] != null)
        {

            String QEmail = Request["email"];
            String Qname = Request["name"];
            String Qsocial = Request["social"];
            String QsocialType = Request["socialType"];
            String Qpicture = Request["image"];

            String[] SplitName = new String[3];
            userMasterBO userMasterBO = new userMasterBO();
            userMasterBAL userMasterBAL = new userMasterBAL();

            SplitName = Qname.Split(' ');

            //give the code to insert data into the usermaster table.
            userMasterBO.email = QEmail;
            userMasterBO.firstName = SplitName[0];
            userMasterBO.lastName = (SplitName.Count() > 1) ? SplitName[1] : "NULL";
            userMasterBO.middleName = (SplitName.Count() > 2) ? SplitName[2] : "NULL";
            userMasterBO.password = "";

            userMasterBO.socialNetwork = true;
            userMasterBO.status = true;
            userMasterBO.roleId = 3;  //3 for user , 2 for mp,1 for admin, 4  for moderator
            userMasterBO.snTypeId = userMasterBAL.getSocialNetworkId(QsocialType); //fetch the corresponding id of socialnetwork
            userMasterBO.profilePicPath = (Qpicture.Length > 1) ? Qpicture : "NULL";
            //insert data into the database.
            string msg = userMasterBAL.insertUser(userMasterBO).ToString();
            userMasterBO.guid = Convert.ToInt64(userMasterBAL.getGuid(userMasterBO));
            guId = userMasterBO.guid;
            name = userMasterBO.firstName;
            Email = userMasterBO.email;
            CreateSession();
            return true;
        }

        else

            return false;
    }