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; }
public static string generatePasscode(string emailidval) { userMasterBO x = new userMasterBO(); userMasterBAL y = new userMasterBAL(); Page CurPage = HttpContext.Current.Handler as Page; //TextBox tx= (TextBox)CurPage.FindControl("signinemail"); // string ss= tx.Text; // HiddenField hf = (HiddenField)CurPage.FindControl("HiddenField2"); if (emailidval != "") { //check email first x.email = emailidval; bool valid = y.checkValidEmailToResetPassword(x); if (valid == true) { //here we will check passcode is null or not. if null we will create the passcode and save into database and email passcode to users. bool passnull = y.checkPasscode(x); if (true) // if (passnull == true) { // first create the passcode here. to generate passcode i have to write the storedprocedure Random rnd = new Random(); int passcode = rnd.Next(00000000, 99999999); x.passcode = passcode; //code to send email MailMessage vMsg = new MailMessage(); MailAddress vFrom = new MailAddress("*****@*****.**", "RATEmymp"); vMsg.From = vFrom; vMsg.To.Add(x.email); //This is a string which contains delimited :semicolons for multiple vMsg.Subject = "Passcode to reset Password in rateMyMp"; //This is the subject; vMsg.Body = passcode.ToString(); //This is the message that needs to be passed. //Create an object SMTPclient for relaying // SmtpClient vSmtp = new SmtpClient(); SmtpClient vSmtp = new SmtpClient("smtp.gmail.com", 587); vSmtp.Host = ConfigurationManager.AppSettings["SMTP"]; vSmtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]); //vSmtp.Credentials = new System.Net.NetworkCredential("lovelybatch", ConfigurationManager.AppSettings["FROMPWD"]); vSmtp.EnableSsl = true; vSmtp.Send(vMsg); //now store same passcode in database under corresponding email address bool success = y.insertPasscode(x); if (success == true) { //HiddenField2.Value = "true"; // CurPage. ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "showdiv()", true); // CurPage.ClientScript.RegisterStartupScript( CurPage.GetType(), "myfunction", "showdiv()", true); // ScriptManager.RegisterClientScriptBlock(CurPage,typeof(System.Web.UI.Page),"myfunction","showdiv()",true); return("showdivs"); } else { return("xyz");; } } //else //{ // //HiddenField2.Value = "true"; // // CurPage. ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "showdiv()", true); // return "showdivs"; //} } else { // CurPage.ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "invalidEmail()", true); return("invalidEmails"); } } else { // CurPage.ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "enterEmail()", true); return("enterEmails"); } }
public static string generatePasscode(string emailidval) { userMasterBO x = new userMasterBO(); userMasterBAL y = new userMasterBAL(); Page CurPage = HttpContext.Current.Handler as Page; //TextBox tx= (TextBox)CurPage.FindControl("signinemail"); // string ss= tx.Text; // HiddenField hf = (HiddenField)CurPage.FindControl("HiddenField2"); if (emailidval != "") { //check email first x.email = emailidval; bool valid = y.checkValidEmailToResetPassword(x); if (valid == true) { //here we will check passcode is null or not. if null we will create the passcode and save into database and email passcode to users. bool passnull = y.checkPasscode(x); if ( true) // if (passnull == true) { // first create the passcode here. to generate passcode i have to write the storedprocedure Random rnd = new Random(); int passcode = rnd.Next(00000000, 99999999); x.passcode = passcode; //code to send email MailMessage vMsg = new MailMessage(); MailAddress vFrom = new MailAddress("*****@*****.**", "RATEmymp"); vMsg.From = vFrom; vMsg.To.Add(x.email); //This is a string which contains delimited :semicolons for multiple vMsg.Subject = "Passcode to reset Password in rateMyMp"; //This is the subject; vMsg.Body = passcode.ToString(); //This is the message that needs to be passed. //Create an object SMTPclient for relaying // SmtpClient vSmtp = new SmtpClient(); SmtpClient vSmtp = new SmtpClient("smtp.gmail.com", 587); vSmtp.Host = ConfigurationManager.AppSettings["SMTP"]; vSmtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]); //vSmtp.Credentials = new System.Net.NetworkCredential("lovelybatch", ConfigurationManager.AppSettings["FROMPWD"]); vSmtp.EnableSsl = true; vSmtp.Send(vMsg); //now store same passcode in database under corresponding email address bool success = y.insertPasscode(x); if (success == true) { //HiddenField2.Value = "true"; // CurPage. ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "showdiv()", true); // CurPage.ClientScript.RegisterStartupScript( CurPage.GetType(), "myfunction", "showdiv()", true); // ScriptManager.RegisterClientScriptBlock(CurPage,typeof(System.Web.UI.Page),"myfunction","showdiv()",true); return "showdivs"; } else { return "xyz"; ; } } //else //{ // //HiddenField2.Value = "true"; // // CurPage. ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "showdiv()", true); // return "showdivs"; //} } else { // CurPage.ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "invalidEmail()", true); return "invalidEmails"; } } else { // CurPage.ClientScript.RegisterStartupScript(CurPage.GetType(), "myfunction", "enterEmail()", true); return "enterEmails"; } }