public int UpdateUserDA(BusinessEntitiesBS.UserEntities.userobj updateuserObjDa, int userid) { try { SqlParameter[] sqlParams = new SqlParameter[7]; //Catgory parameters sqlParams[0] = new SqlParameter("@uid", userid); sqlParams[1] = new SqlParameter("@username", updateuserObjDa.uname); sqlParams[2] = new SqlParameter("@pwd", updateuserObjDa.pwd); sqlParams[3] = new SqlParameter("@email", updateuserObjDa.emailid); sqlParams[4] = new SqlParameter("@phone", updateuserObjDa.phno); sqlParams[5] = new SqlParameter("@address", updateuserObjDa.address); sqlParams[6] = new SqlParameter("@actvsts", updateuserObjDa.userstatus); int updated = DBHelper.ExecuteNonQuery(DBCommon.ConnectionString, "USP_UPDATE_USERS", sqlParams); if (updated > 0) { return(updated); } else { return(-1); } } catch (SqlException exc) { return(-1); throw exc; } }
public int UpdateUsers(BusinessEntitiesBS.UserEntities.userobj updateuserObj, int userid) { IAdminDA UpdateUserValues = new DataAccessBS.AdminClasses.AdminDA(); int updateuserId = UpdateUserValues.UpdateUserDA(updateuserObj, userid); return(updateuserId); }
protected void btn_reg_Click(object sender, EventArgs e) { if (lbl_checkemail.Text == HardCodedValues.BuddaResource.EmailIdAvailable) { //Check whether the Captcha text is correct or not if (this.txt_captcha.Text == this.Session["CaptchaImageText"].ToString()) { string uname = txt_username.Text; string emailid = txt_emailid.Text; string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(txt_password.Text); bool verfyDomain = verifyDomain(emailid); bool chkEmail = sendEmail(emailid); if (verfyDomain && chkEmail) { BusinessEntitiesBS.UserEntities.userobj userObj = new BusinessEntitiesBS.UserEntities.userobj(); userObj.uname = uname; userObj.emailid = emailid; userObj.pwd = encryptedpwd; try { IUser userInsert = new UserItems(); //insert new user details in database with given values userInsert.insertUser(userObj); dt = userInsert.checklogin(emailid, encryptedpwd); this.Session["currentuser"] = dt; //lbl_register.Text = "Registration Successfull"; Response.Redirect("~/USER/ProfilePage.aspx"); } catch (Exception exp) { lbl_register.Text = HardCodedValues.BuddaResource.CatchBlockError + exp.Message; } } else { lbl_register.Text = "Registration Incomplete! Invalid email id or domain. Please provide valid email for regitration."; } } else { txt_captcha.Text = ""; lbl_captcha.Text = HardCodedValues.BuddaResource.CaptchaError; // Create a random Captcha and store it in the Session object. this.Session["CaptchaImageText"] = Captcha.CaptchaImage.GenerateRandomCode(7); txt_captcha.Focus(); } } else { txt_emailid.Focus(); } }
/// <summary> /// This method will do /// </summary> /// <param name="userobjDA"></param> public void insertUserDA(BusinessEntitiesBS.UserEntities.userobj userobjDA) { try { SqlParameter[] sqlParams = new SqlParameter[3]; //User parameters sqlParams[0] = new SqlParameter("@uname", userobjDA.uname); sqlParams[1] = new SqlParameter("@emailid", userobjDA.emailid); sqlParams[2] = new SqlParameter("@pwd", userobjDA.pwd); DBHelper.ExecuteNonQuery(DBCommon.ConnectionString, "USP_INSERT_USERS", sqlParams); } catch (SqlException exc) { throw exc; } }
protected void userGrid_RowUpdating(object sender, GridViewUpdateEventArgs e) { int userid = Convert.ToInt32(userGrid.DataKeys[e.RowIndex].Value.ToString()); string username = userGrid.DataKeys[e.RowIndex].Values["UserName"].ToString(); string password = userGrid.DataKeys[e.RowIndex].Values["PWD"].ToString(); TextBox newpassword = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editpwd"); TextBox emailid = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editemailid"); TextBox phno = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editphno"); TextBox address = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editaddress"); CheckBox userstatus = (CheckBox)userGrid.Rows[e.RowIndex].FindControl("cb_editactvsts"); string encryptedpwd; if (password == newpassword.Text) { encryptedpwd = newpassword.Text; } else { encryptedpwd = CLASS.PasswordEncryption.EncryptIt(newpassword.Text); } BusinessEntitiesBS.UserEntities.userobj UpdateUserObj = new BusinessEntitiesBS.UserEntities.userobj(); UpdateUserObj.uname = username; UpdateUserObj.pwd = encryptedpwd; UpdateUserObj.emailid = emailid.Text; UpdateUserObj.phno = phno.Text; UpdateUserObj.address = address.Text; UpdateUserObj.userstatus = userstatus.Checked; IAdmin UpdateUsers = new AdminItems(); int updated = UpdateUsers.UpdateUsers(UpdateUserObj, userid); if (updated != -1) { lbl_status.Text = HardCodedValues.BuddaResource.UpdateSuccess; userGrid.EditIndex = -1; searchDT(txt_username.Text); } else { lbl_status.Text = HardCodedValues.BuddaResource.UpdateFail; } }
public bool RegisterUser(string emailid, string password) { try { IUser checkuser = new UserItems(); //returns the table if given emailid exists dt = checkuser.checkavailability(emailid); if (dt == null) { string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(password); BusinessEntitiesBS.UserEntities.userobj userObj = new BusinessEntitiesBS.UserEntities.userobj(); userObj.uname = ""; userObj.emailid = emailid; userObj.pwd = encryptedpwd; try { IUser userInsert = new UserItems(); //insert new user details in database with given values userInsert.insertUser(userObj); DataTable dt2 = userInsert.checklogin(emailid, encryptedpwd); this.Session["currentuser"] = dt2; return(true); } catch (Exception exp) { return(false); } } else { return(false); } } catch (Exception ex) { return(false); } }
protected void userGrid_RowUpdating(object sender, GridViewUpdateEventArgs e) { int userid = Convert.ToInt32(userGrid.DataKeys[e.RowIndex].Value.ToString()); string username = userGrid.DataKeys[e.RowIndex].Values["UserName"].ToString(); string password = userGrid.DataKeys[e.RowIndex].Values["PWD"].ToString(); TextBox newpassword = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editpwd"); TextBox emailid = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editemailid"); TextBox phno = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editphno"); TextBox address = (TextBox)userGrid.Rows[e.RowIndex].FindControl("txt_editaddress"); CheckBox userstatus = (CheckBox)userGrid.Rows[e.RowIndex].FindControl("cb_editactvsts"); string encryptedpwd; if (password == newpassword.Text) { encryptedpwd = newpassword.Text; } else { encryptedpwd = CLASS.PasswordEncryption.EncryptIt(newpassword.Text); } BusinessEntitiesBS.UserEntities.userobj UpdateUserObj=new BusinessEntitiesBS.UserEntities.userobj(); UpdateUserObj.uname=username; UpdateUserObj.pwd = encryptedpwd; UpdateUserObj.emailid=emailid.Text; UpdateUserObj.phno=phno.Text; UpdateUserObj.address=address.Text; UpdateUserObj.userstatus=userstatus.Checked; IAdmin UpdateUsers = new AdminItems(); int updated = UpdateUsers.UpdateUsers(UpdateUserObj, userid); if (updated != -1) { lbl_status.Text = HardCodedValues.BuddaResource.UpdateSuccess; userGrid.EditIndex = -1; searchDT(txt_username.Text); } else { lbl_status.Text = HardCodedValues.BuddaResource.UpdateFail; } }
public bool RegisterUser(string emailid, string password) { try { IUser checkuser = new UserItems(); //returns the table if given emailid exists dt = checkuser.checkavailability(emailid); if (dt == null) { string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(password); BusinessEntitiesBS.UserEntities.userobj userObj = new BusinessEntitiesBS.UserEntities.userobj(); userObj.uname = ""; userObj.emailid = emailid; userObj.pwd = encryptedpwd; try { IUser userInsert = new UserItems(); //insert new user details in database with given values userInsert.insertUser(userObj); DataTable dt2 = userInsert.checklogin(emailid, encryptedpwd); this.Session["currentuser"] = dt2; return true; } catch (Exception exp) { return false; } } else { return false; } } catch (Exception ex) { return false; } }
protected void btn_reg_Click(object sender, EventArgs e) { if (lbl_checkemail.Text == HardCodedValues.BuddaResource.EmailIdAvailable) { //Check whether the Captcha text is correct or not if (this.txt_captcha.Text == this.Session["CaptchaImageText"].ToString()) { string uname = txt_username.Text; string emailid = txt_emailid.Text; string encryptedpwd = CLASS.PasswordEncryption.EncryptIt(txt_password.Text); bool verfyDomain = verifyDomain(emailid); bool chkEmail = sendEmail(emailid); if (verfyDomain && chkEmail) { BusinessEntitiesBS.UserEntities.userobj userObj = new BusinessEntitiesBS.UserEntities.userobj(); userObj.uname = uname; userObj.emailid = emailid; userObj.pwd = encryptedpwd; try { IUser userInsert = new UserItems(); //insert new user details in database with given values userInsert.insertUser(userObj); dt = userInsert.checklogin(emailid, encryptedpwd); this.Session["currentuser"] = dt; //lbl_register.Text = "Registration Successfull"; Response.Redirect("~/USER/ProfilePage.aspx"); } catch (Exception exp) { lbl_register.Text = HardCodedValues.BuddaResource.CatchBlockError + exp.Message; } } else { lbl_register.Text = "Registration Incomplete! Invalid email id or domain. Please provide valid email for regitration."; } } else { txt_captcha.Text = ""; lbl_captcha.Text = HardCodedValues.BuddaResource.CaptchaError; // Create a random Captcha and store it in the Session object. this.Session["CaptchaImageText"] = Captcha.CaptchaImage.GenerateRandomCode(7); txt_captcha.Focus(); } } else { txt_emailid.Focus(); } }
public void insertUser(BusinessEntitiesBS.UserEntities.userobj userobj) { IUserDA userInsert = new DataAccessBS.UserClasses.UserDA(); userInsert.insertUserDA(userobj); }