protected void btnGuardar_Click(object sender, EventArgs e) { try { vendedorTDA = (VendedorTDA)Session["sellerSelect"]; if (vendedorTDA == null) { vendedorTDA = new VendedorTDA(); vendedorTDA.Document = txtCedula.Text; vendedorTDA.Name = txtNombre.Text; vendedorTDA.Last_Name = txtApellido.Text; vendedorTDA.Email = txtEmail.Text; vendedorTDA.Address = txtDireccion.Text; vendedorTDA.Phone = txtPhone.Text; int codigo = dba.executeUpdate(vendedorTDA.buildNonQuery(Record.NON_QUERY_INSERT)); vendedorTDA.Code = codigo; //Session["clientSelect"] = clienteTDA; //btnNuevo.Visible = true; } else { vendedorTDA.Document = txtCedula.Text; vendedorTDA.Name = txtNombre.Text; vendedorTDA.Last_Name = txtApellido.Text; vendedorTDA.Email = txtEmail.Text; vendedorTDA.Address = txtDireccion.Text; vendedorTDA.Phone = txtPhone.Text; dba.executeUpdate(vendedorTDA.buildNonQuery(Record.NON_QUERY_UPDATE)); //Session["PersonaListDataSource"] = null; //Session["personaSelect"] = null; } Session["Page_Load_Seller"] = false; Response.Redirect(Constants.NAV_RULE_LISTA_VENDEDOR); }catch (Exception error){ lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }
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 vendedorTDA = (VendedorTDA)Session["sellerSelect"]; if (vendedorTDA != null && !(bool)Session["Page_Load_Seller"]) { txtCodigo.Text = vendedorTDA.Code + ""; txtCedula.Text = vendedorTDA.Document; txtNombre.Text = vendedorTDA.Name; txtApellido.Text = vendedorTDA.Last_Name; txtEmail.Text = vendedorTDA.Email; txtDireccion.Text = vendedorTDA.Address; txtPhone.Text = vendedorTDA.Phone; //ddlRol.SelectedItem.Value = usuarioTDA.Rol; Session["Page_Load_Seller"] = true; } } catch (Exception error) { lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }
protected void Vendedor_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow fila = listadoVendedor.SelectedRow; try { listDataSource = getListDataSource(); if (e.CommandName == "Order") { if (listDataSource != null) { int index = Convert.ToInt32(e.CommandArgument); Session["Page_Load_sellerCode"] = false; Session["seller"] = listDataSource.ElementAt(index); GridViewRow row = listadoVendedor.Rows[index]; } } vendedorTDA = (VendedorTDA)Session["seller"]; if (vendedorTDA != null && !(bool)Session["Page_Load_sellerCode"]) { Response.Write(vendedorTDA.Code + ""); Response.Write("<br>"); Response.Write(vendedorTDA.Document); } } catch (Exception error) { lblError.Text = "Se presento un error no controlado [" + error + "]."; lblError.Visible = true; } }