Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Page_Load(object sender, EventArgs e)
- {
- string UserName;
- if (Session["User"] == null)
- {
- Response.Redirect("Home.aspx");
- }
- if ((Session["AdminMode"] == "1") || (Session["AdminMode"] == "2"))
- UserName = Session["AdminEditUser"].ToString();
- else
- UserName = Session["User"].ToString();
- if (!IsPostBack)
- {
- int i, j;
- string birthDate;
- string connectionStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:WebSitesMyWebsiteApp_DataDataBase.mdb;Persist Security Info=True";
- OleDbConnection connectObj = new OleDbConnection(connectionStr);
- string mySql = "SELECT * from Users WHERE UserName= '" + UserName + "'";
- OleDbDataAdapter dataAdapt = new OleDbDataAdapter(mySql, connectObj);
- DataSet ds = new DataSet();
- dataAdapt.Fill(ds, "Users");
- DataRow row = ds.Tables["Users"].Rows[0];
- AccountText.Text = UserName.ToString();
- pass.Text = row[2].ToString();
- passchecker.Text = row[2].ToString();
- firstname.Text = row[3].ToString();
- lastname.Text = row[4].ToString();
- MyEmail.Text = row[5].ToString();
- PlaceList.Text = row[6].ToString();
- }
- protected void EditClick_Click(object sender, EventArgs e)
- {
- string eMailAvailable = MyEmail.Text;
- string usercheck = users.IsEmailBelong(eMailAvailable);
- bool eMailCheck = users.IsEmailExist(eMailAvailable);
- if (eMailCheck == true)
- {
- if (usercheck == UserName)
- {
- IsEmail.Text = "";
- MyEmail.BackColor = System.Drawing.Color.White;
- }
- else
- {
- IsEmail.Text = "";
- MyEmail.BackColor = System.Drawing.Color.IndianRed;
- }
- }
- else
- {
- MyEmail.BackColor = System.Drawing.Color.White;
- }
- if (MyEmail.Text == "")
- {
- int i;
- string userName = UserName;
- string Password = pass.Text;
- string firstName = firstname.Text;
- string lastName = lastname.Text;
- string eMail = MyEmail.Text;
- string cityID = PlaceList.Text;
- bool result = users.EditUser(userName, Password, firstName, lastName, eMail, cityID);
- if (result == true)
- {
- Response.Redirect("Home.aspx");
- }
- }
- }
Add Comment
Please, Sign In to add comment