private void butGuardar_Click(object sender, System.EventArgs e) { try { BindGrid(); IPersonal personal = PersonalFactory.GetPersonalFactory(); DsPersonal ds = (DsPersonal)Session["Personal"]; foreach (DsPersonal.DatosRow dr in ds.Datos) { personal.PersonalID = dr.PersonalID; if (dr.Asignado) { personal.Categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text); } else { personal.Categoria.CategoriaID = 0; } personal.ActualizarCategoria(); } } catch (Exception ex) { ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message); } }
private void BindGrid() { try { ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory(); categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text); AdministrarGrillas.Configurar(dtgPersonal, "PersonalID", CantidadOpciones, true, false); dtgPersonal.CurrentPageIndex = Utiles.Validaciones.obtieneEntero(txtPagina.Text); DsPersonal ds = new DsPersonal(); //if(Session["Personal"] == null) ds = categoria.GetPersonal(txtLegajo.Text, txtNombre.Text, txtApellido.Text); //else // ds = (DsPersonal)Session["Personal"]; foreach (DataGridItem item in dtgPersonal.Items) { DsPersonal.DatosRow dr = (DsPersonal.DatosRow)ds.Datos.Rows[item.DataSetIndex]; CheckBox chk = (CheckBox)item.FindControl("chkAsigando"); dr.Asignado = chk.Checked; } Session["Personal"] = ds; dtgPersonal.DataSource = ds.Datos; dtgPersonal.DataBind(); } catch (Exception ex) { ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message); } }
public void Consultar() { try { DsPersonal ds = new DsPersonal(); SqlParameter pPersonalID = new SqlParameter("@PersonalID", Utiles.BaseDatos.IntToSql(PersonalID)); Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PersonalONE", pPersonalID); foreach (DsPersonal.DatosRow dr in ds.Datos) { PersonalID = dr.PersonalID; Legajo = dr.Legajo; Nombre = dr.Nombre; Apellido = dr.Apellido; Domicilio.DomicilioID = dr.DomicilioID; ((Domicilio)Domicilio).Consultar(); Categoria.CategoriaID = dr.IsCategoriaIDNull() ? 0 : dr.CategoriaID; ((CategoriaPersonal)Categoria).Consultar(); User.UsuarioID = dr.IsUsuarioIDNull() ? 0 : dr.UsuarioID; ((Usuarios)User).Consultar(); EstadoPersonalID = dr.EstadoPersonalID; Telefono = dr.IsTelefonoNull() ? "" : dr.Telefono; Email = dr.IsEmailNull() ? "" : dr.Email; TipoEjecutivoCuentaID = dr.IsTipoEjecutivoCuentaIDNull() ? 0 : dr.TipoEjecutivoCuentaID; TipoEjecutivoCuenta = dr.IsTipoEjecutivoCuentaNull() ? "" : dr.TipoEjecutivoCuenta; UnidadNegocioID = dr.UnidadNegocioID; } } catch (Exception ex) { throw ex; } }
public DsPersonal GetPersonal(string legajo, string nombre, string apellido) { try { DsPersonal ds = new DsPersonal(); SqlParameter pCategoriaID = new SqlParameter("@CategoriaID", Utiles.BaseDatos.IntToSql(CategoriaID)); SqlParameter pLegajo = new SqlParameter("@Legajo", Utiles.BaseDatos.StrToSql(legajo)); SqlParameter pNombre = new SqlParameter("@Nombre", Utiles.BaseDatos.StrToSql(nombre)); SqlParameter pApellido = new SqlParameter("@Apellido", Utiles.BaseDatos.StrToSql(apellido)); Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PersonalByCategoriaIDSEL", pCategoriaID, pLegajo, pNombre, pApellido); return(ds); } catch (Exception ex) { throw ex; } }
public DsPersonal GetPersonalByTipoLegajoNombre() { try { DsPersonal ds = new DsPersonal(); SqlParameter pTipo = new SqlParameter("@TipoEjecutivoCuentaID", Utiles.BaseDatos.IntToSql(TipoEjecutivoCuentaID)); SqlParameter pLegajo = new SqlParameter("@Legajo", Utiles.BaseDatos.StrToSql(Legajo)); SqlParameter pNombre = new SqlParameter("@Nombre", Utiles.BaseDatos.StrToSql(Nombre)); SqlParameter pPersonalID = new SqlParameter("@PersonalID", Utiles.BaseDatos.IntToSql(PersonalID)); Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PersonalByTipoLegajoNombreSEL", pTipo, pLegajo, pNombre, pPersonalID); return(ds); } catch (Exception ex) { throw ex; } }
private void Buscar() { try { IPersonal personal = PersonalFactory.GetPersonalFactory(); //personal.PersonalID = Utiles.Validaciones.obtieneEntero(personalID); personal.Nombre = nombre; personal.Legajo = legajo; personal.TipoEjecutivoCuentaID = Utiles.Validaciones.obtieneEntero(tipo); DsPersonal ds = personal.GetPersonalByTipoLegajoNombre(); if (ds.Datos.Count == 1) { foreach (DsPersonal.DatosRow dr in ds.Datos) { txtTipo.Text = dr.TipoEjecutivoCuentaID.ToString(); txtLegajo.Text = dr.Legajo; txtNombre.Text = dr.Apellido + ", " + dr.Nombre; txtPersonalID.Text = dr.PersonalID.ToString(); txtErrorMsg.Text = ""; txtOpen.Text = ""; } } else if (ds.Datos.Count > 1) { txtTipo.Text = tipo; txtLegajo.Text = legajo; txtNombre.Text = nombre; txtPersonalID.Text = ""; txtOpen.Text = "S"; } else { txtTipo.Text = tipo; txtLegajo.Text = legajo; txtNombre.Text = nombre; txtPersonalID.Text = ""; txtErrorMsg.Text = "No se encontraron datos"; txtOpen.Text = ""; } } catch (Exception ex) { txtErrorMsg.Text = "Error al consultar datos " + ex.Message; } }