protected void GridViewToValidate_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ActivateAcc") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridViewToValidate.Rows[index]; string id = row.Cells[1].Text; if (AccStatus.EnableAccount(id) == false) { Response.Redirect("~/Error.aspx"); } } UpdateBadges(); GridViewTotal.DataBind(); GridViewToValidate.DataBind(); EditTablesUpdatePanel.Update(); }
protected void GridViewTotal_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditData") { int index = Convert.ToInt32(e.CommandArgument); GridViewTotal.EditIndex = index; _counter = index; } if (e.CommandName == "DeleteData") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridViewTotal.Rows[index]; string id = row.Cells[1].Text; if (App_Classes.Users.RemoverUserFromDB(id) == false) { Response.Redirect("~/Error.aspx"); } } if (e.CommandName == "CancelEdit") { _counter = -1; GridViewTotal.EditIndex = _counter; } if (e.CommandName == "UpdateData") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridViewTotal.Rows[index]; string id = row.Cells[1].Text; TextBox email = row.FindControl("txtEmail") as TextBox; DropDownList emailconfirmed = row.FindControl("ddlEmailConfirmed") as DropDownList; TextBox passwordhash = row.FindControl("txtPasswordHash") as TextBox; TextBox securitystamp = row.FindControl("txtSecurityStamp") as TextBox; TextBox phonenumber = row.FindControl("txtPhoneNumber") as TextBox; DropDownList phonenumberconfirmed = row.FindControl("ddlPhoneNumberConfirmed") as DropDownList; DropDownList twofactorenabled = row.FindControl("ddlTwoFactorEnabled") as DropDownList; TextBox lockoutenddateutc = row.FindControl("txtLockoutEndDateUtc") as TextBox; DateTime LockoutDateEnd = DateTime.Parse(lockoutenddateutc.Text); DropDownList lockoutenabled = row.FindControl("ddlLockoutEnabled") as DropDownList; TextBox accessfailedcount = row.FindControl("txtAccessFailedCount") as TextBox; TextBox username = row.FindControl("txtUserName") as TextBox; TextBox workshopname = row.FindControl("txtWorkshopName") as TextBox; TextBox workshopphone = row.FindControl("txtWorkshopPhone") as TextBox; TextBox workshopowner = row.FindControl("txtWorkshopOwner") as TextBox; TextBox workshopownernif = row.FindControl("txtWorkshopOwnerNIF") as TextBox; TextBox workshopaddress = row.FindControl("txtWorkshopAddress") as TextBox; TextBox workshopregion = row.FindControl("txtWorkshopRegion") as TextBox; DropDownList isenabled = row.FindControl("ddlIsEnabled") as DropDownList; TextBox displayname = row.FindControl("txtDisplayName") as TextBox; if (App_Classes.Users.UpdateUserInfo(id, email.Text, emailconfirmed.SelectedValue, passwordhash.Text, securitystamp.Text, phonenumber.Text, phonenumberconfirmed.SelectedValue, twofactorenabled.SelectedValue, LockoutDateEnd, lockoutenabled.SelectedValue, accessfailedcount.Text, username.Text, workshopname.Text, workshopphone.Text, workshopowner.Text, workshopownernif.Text, workshopaddress.Text, workshopregion.Text, isenabled.SelectedValue, displayname.Text) == false) { Response.Redirect("~/Error.aspx"); } GridViewTotal.EditIndex = -1; } UpdateBadges(); GridViewTotal.DataBind(); GridViewToValidate.DataBind(); EditTablesUpdatePanel.Update(); }