protected void Page_Load(object sender, EventArgs e) { //Cargamos la info del usuario que se selecciona en el listado de los usuarios para modificarla try{ lblError.Text = ""; lblError.Visible = false; dba = DataBaseAccess.getInstance(); //se carga la informacion de la persona clienteTDA = (ClienteTDA)Session["clientSelect"]; if (clienteTDA != null && !(bool)Session["Page_Load_Client"]){ txtCodigo.Text = clienteTDA.Code + ""; txtCedula.Text = clienteTDA.Document; txtNombre.Text = clienteTDA.Name; txtApellido.Text = clienteTDA.Last_Name; txtEmail.Text = clienteTDA.Email; txtDireccion.Text = clienteTDA.Address; txtPhone.Text = clienteTDA.Phone; //ddlRol.SelectedItem.Value = usuarioTDA.Rol; Session["Page_Load_Client"] = true; } } catch (Exception error){ lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }
//20 protected void Cliente_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow fila = listadoClientes.SelectedRow; try{ listDataSource = getListDataSource(); if (e.CommandName == "Order"){ if (listDataSource != null){ int index = Convert.ToInt32(e.CommandArgument); Session["Page_Load_ClientCode"] = false; Session["client"] = listDataSource.ElementAt(index); GridViewRow row = listadoClientes.Rows[index]; } } clienteTDA = (ClienteTDA)Session["client"]; if (clienteTDA != null && !(bool)Session["Page_Load_ClientCode"]){ Response.Write(clienteTDA.Code + ""); Response.Write("<br>"); Response.Write(clienteTDA.Document); } }catch (Exception error){ lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }
protected void btnGuardar_Click(object sender, EventArgs e) { try{ clienteTDA = (ClienteTDA)Session["clientSelect"]; if (clienteTDA == null){ clienteTDA = new ClienteTDA(); clienteTDA.Document = txtCedula.Text; clienteTDA.Name = txtNombre.Text; clienteTDA.Last_Name = txtApellido.Text; clienteTDA.Email = txtEmail.Text; clienteTDA.Address = txtDireccion.Text; clienteTDA.Phone = txtPhone.Text; int codigo = dba.executeUpdate(clienteTDA.buildNonQuery(Record.NON_QUERY_INSERT)); clienteTDA.Code = codigo; //Session["clientSelect"] = clienteTDA; //btnNuevo.Visible = true; } else{ clienteTDA.Document = txtCedula.Text; clienteTDA.Name = txtNombre.Text; clienteTDA.Last_Name = txtApellido.Text; clienteTDA.Email = txtEmail.Text; clienteTDA.Address = txtDireccion.Text; clienteTDA.Phone = txtPhone.Text; dba.executeUpdate(clienteTDA.buildNonQuery(Record.NON_QUERY_UPDATE)); //Session["PersonaListDataSource"] = null; //Session["personaSelect"] = null; } Session["Page_Load_Client"] = false; Response.Redirect(Constants.NAV_RULE_LISTA_CLIENTE); } catch (Exception error){ lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }