protected void Btn_Save_Click(object sender, EventArgs e) { try { if (IsValid) { MercadoUDi_DataSetTableAdapters.UserTableAdapter tau = new MercadoUDi_DataSetTableAdapters.UserTableAdapter(); string password = ""; if (Session["Username"].ToString() != txt_Username.Text) { if (Session["User_PasswordRegister"].ToString() != txt_Password.Text) { password = Encrypt(txt_Password.Text); } else { password = Session["User_PasswordRegister"].ToString(); } Session["uName"] = txt_Username.Text; Session["uEmail"] = txt_Email.Text; Session["uStatus"] = DropDownList_Status.SelectedItem.Text; if (DropDownList_UserType.SelectedItem.Text == "Administrator") { Session["uType"] = 1; } else { Session["uType"] = 2; } string UserCard = txt_UserCard.Text; tau.Update(Session["uName"].ToString(), Session["uEmail"].ToString(), password, Session["uStatus"].ToString(), Convert.ToInt32(Session["uType"].ToString()), UserCard, id_User); string script = @"alert('This User has been deleted!'); window.location.href='Remove_Users.aspx';"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", script, true); //talog.Insert("Update User", (string)Session["Username"], System.DateTime.Now); } } else { Response.Write("<script>alert('Fill in the fields correctly');</script>"); } } catch (Exception error) { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alerta", "alert('The following error has occurred: " + error.Message + " ');", true); } }
protected void Btn_Save_Click(object sender, EventArgs e) { try { if (IsValid) { MercadoUDi_DataSetTableAdapters.UserTableAdapter tau = new MercadoUDi_DataSetTableAdapters.UserTableAdapter(); string password = ""; if (Session["User_PasswordRegisterConfig"].ToString() != txt_Password.Text) { password = Encrypt(txt_Password.Text); } else { password = Session["User_PasswordRegisterConfig"].ToString(); } Session["uName_Config"] = txt_Username.Text; Session["uEmail_Config"] = txt_Email.Text; string UserCard = txt_UserCard.Text; tau.Update(Session["uName_Config"].ToString(), Session["uEmail_Config"].ToString(), password, Session["User_Status"].ToString(), Convert.ToInt32(Session["User_Type"].ToString()), UserCard, id_User); string script = @"alert('You have updated your information personal..'); window.location.href='DefaultAdmin.aspx';"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", script, true); //talog.Insert("The user updated it personal information byself...", (string)Session["Username"], System.DateTime.Now); } else { Response.Write("<script>alert('Fill in the fields correctly');</script>"); } } catch (Exception error) { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alerta", "alert('The following error has occurred: " + error.Message + " ');", true); } }