public ActionResult Edit(int id) { Boleta Boleta = BoletaBL.GetById(id); if (Boleta != null) { var ListCliente = ClienteBL.GetList(); ViewBag.ListCliente = Catalogo.GetSelectListFromCatalog(ListCliente.Select(x => new Catalogo() { Id = x.Id, Nombre = x.Nombre }).ToList()); var ListProyecto = ProyectoBL.GetList(); ViewBag.ListProyecto = Catalogo.GetSelectListFromCatalog(ListProyecto.Select(x => new Catalogo() { Id = x.Id, Nombre = x.Nombre }).ToList()); var ListTiempoInvertido = CatalogoBL.GetList(CatalogoEnum.TiempoInvertido); ViewBag.ListTiempoInvertido = Catalogo.GetSelectListFromCatalog(ListTiempoInvertido); var ListDepartamento = CatalogoBL.GetList(CatalogoEnum.Departamento); ViewBag.Departamento = Catalogo.GetSelectListFromCatalog(ListDepartamento); return(View(Boleta)); } else { return(RedirectToAction("Index")); } }
private void dgvModelos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && busqueda) { long idCatalogo = Convert.ToInt64(dgvModelos.Rows[e.RowIndex].Cells["Id"].Value); Catalogo modelo = CatalogoBL.obtenerCatalogo(idCatalogo, ref error, ref mensaje); if (!error) { Catalogo marca = CatalogoBL.obtenerCatalogo(Convert.ToInt64(cbMarca.SelectedValue), ref error, ref mensaje); if (!error) { frmNuevoModificarEquipo.establecerMarca(marca); frmNuevoModificarEquipo.establecerModelo(modelo); this.Close(); } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ActionResult Create() { var ListCliente = ClienteBL.GetList(); ViewBag.ListCliente = Catalogo.GetSelectListFromCatalog(ListCliente.Select(x => new Catalogo() { Id = x.Id, Nombre = x.Nombre }).ToList()); var ListProyecto = ProyectoBL.GetList(); ViewBag.ListProyecto = Catalogo.GetSelectListFromCatalog(ListProyecto.Select(x => new Catalogo() { Id = x.Id, Nombre = x.Nombre }).ToList()); var ListTiempoInvertido = CatalogoBL.GetList(CatalogoEnum.TiempoInvertido); ViewBag.ListTiempoInvertido = Catalogo.GetSelectListFromCatalog(ListTiempoInvertido); var ListDepartamento = CatalogoBL.GetList(CatalogoEnum.Departamento); ViewBag.Departamento = Catalogo.GetSelectListFromCatalog(ListDepartamento); return(View()); }
public void BoletaBL_Create() { var LisCliente = ClienteBL.GetList(false); var ListUsuario = UsuarioBL.GetList(false); var ListProyecto = ProyectoBL.GetList(false); var ListDepartamento = CatalogoBL.GetList(CatalogoEnum.Departamento, false); var ListTiempoInvertido = CatalogoBL.GetList(CatalogoEnum.TiempoInvertido, false); Boleta _Boleta = new Boleta() { Id = 0, ClienteId = LisCliente.First().Id, DepartamentoId = ListDepartamento.First().Id, FechaEntrada = DateTime.Now, FechaSalida = DateTime.Now, NumeroBoleta = "PRUEBA", ProyectoId = ListProyecto.First().Id, TiempoEfectivo = 0, TiempoInvertidoEn = ListTiempoInvertido.First().Id, UsuarioId = ListUsuario.First().Id, EsActivo = false, FechaRegistro = DateTime.Now, }; var Boleta = BoletaBL.Create(_Boleta); Assert.IsTrue(Boleta.Id > 0); }
public IEnumerable <System.Web.Mvc.SelectListItem> ComboTipoCliente(string CodigoTipoCliente) { CatalogoBL objBL = new CatalogoBL(); List <Catalogo> Lista = new List <Catalogo>(); Lista = objBL.ListarPorTipo("TIPO_CLIENTE"); List <SelectListItem> data_list = new List <SelectListItem>(); data_list.Add(new SelectListItem() { Text = string.Format("[{0}]", "SELECCIONAR"), Value = "0" }); foreach (Catalogo c in Lista) { data_list.Add(new SelectListItem() { Text = c.Valor, Value = Convert.ToString(c.IdCatalogo) }); } if (CodigoTipoCliente == "0") { return(new SelectList(data_list, "Value", "Text")); } else { return(new SelectList(data_list, "Value", "Text", CodigoTipoCliente)); } }
public IEnumerable <System.Web.Mvc.SelectListItem> combotipoempresa(string value, string codigo) { CatalogoBL objBL = new CatalogoBL(); List <Catalogo> Lista = objBL.ListarPorTipo("TIPO_EMPRESA_TRANSPORTISTA"); List <SelectListItem> data_list = new List <SelectListItem> { new SelectListItem() { Text = string.Format("[{0}]", "SELECCIONAR"), Value = "0" } }; data_list.AddRange(Lista.OrderBy(a => a.IdCatalogo).Select(a => new SelectListItem() { Text = a.Valor.ToUpper(), Value = a.Codigo })); if (codigo == "0") { return(new SelectList(data_list, "Value", "Text")); } else { return(new SelectList(data_list, "Value", "Text", codigo)); } }
public void CatalogoBL_Departamento_GetById() { var ListCatalogo = CatalogoBL.GetList(CatalogoEnum.Departamento, false); var Catalogo = CatalogoBL.GetById(ListCatalogo.First().Id, CatalogoEnum.Departamento, false); Assert.IsNotNull(Catalogo); }
public void CatalogoBL_Departamento_Delete() { var ListCatalogo = CatalogoBL.GetList(CatalogoEnum.Departamento, false); var _Catalogo = ListCatalogo.First(); bool Result = CatalogoBL.Delete(_Catalogo.Id, CatalogoEnum.Departamento); Assert.IsTrue(Result); }
public void CatalogoBL_Departamento_Update() { var ListCatalogo = CatalogoBL.GetList(CatalogoEnum.Departamento, false); var _Catalogo = ListCatalogo.First(); _Catalogo.Nombre = "Prueba unitaria modificada"; bool Result = CatalogoBL.Update(_Catalogo, CatalogoEnum.Departamento); Assert.IsTrue(Result); }
public void actualizarDgvMarcas() { IEnumerable dataSource = CatalogoBL.filtrarMarcas(txtMarca.Text.Trim(), ref error, ref mensaje); if (!error) { dgvMarcas.DataSource = dataSource; dgvMarcas.Columns[0].Visible = false; } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CatalogoBL_EstadoVisita_Create() { Catalogo _Catalogo = new Catalogo() { Id = 0, EsActivo = false, FechaRegistro = DateTime.Now, Nombre = "Prueba", }; var Catalogo = CatalogoBL.Create(_Catalogo, CatalogoEnum.EstadoVisita); Assert.IsTrue(Catalogo.Id > 0); }
public void CatalogoBL_TiempoInvertido_Create() { Catalogo _Catalogo = new Catalogo() { Id = 0, EsActivo = false, FechaRegistro = DateTime.Now, Nombre = "Prueba", }; var Catalogo = CatalogoBL.Create(_Catalogo, CatalogoEnum.TiempoInvertido); Assert.IsTrue(Catalogo.Id > 0); }
public void actualizarDgvModelos() { IEnumerable dataSource = CatalogoBL.filtrarModelos(Convert.ToInt64(cbMarca.SelectedValue), txtModelo.Text.Trim(), ref error, ref mensaje); if (!error) { dgvModelos.DataSource = dataSource; dgvModelos.Columns[0].Visible = false; } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (validarCampos()) { switch (operacion) { case "N": CatalogoBL.insertarCatalogo(objetoModelo(), ref error, ref mensaje); break; case "M": CatalogoBL.actualizarCatalogo(objetoModelo(), ref error, ref mensaje); break; } if (!error) { frmModelos.actualizarDgvModelos(); switch (operacion) { case "N": mensaje = "Modelo registado exitosamente."; break; case "M": mensaje = "Modelo actualizado exitosamente."; break; } DialogResult result = MessageBox.Show(mensaje, "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Information); if (result == DialogResult.OK) { switch (operacion) { case "N": limpiarCampos(); break; case "M": this.Close(); break; } } } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void ActividadBL_Create() { var ListEstadoVisita = CatalogoBL.GetList(CatalogoEnum.EstadoVisita, false); Actividad _Actividad = new Actividad() { Id = 0, EsActivo = false, FechaRegistro = DateTime.Now, Descripcion = "Prueba unitaria", EstadoId = ListEstadoVisita.First().Id }; var Actividad = ActividadBL.Create(_Actividad); Assert.IsTrue(Actividad.Id > 0); }
// GET: Index/id:int -> actividadId public ActionResult Edit(int id) { var ListEstadoActividad = CatalogoBL.GetList(CatalogoEnum.EstadoVisita); ViewBag.ListEstadoActividad = Catalogo.GetSelectListFromCatalog( ListEstadoActividad.Select(x => new Catalogo() { Id = x.Id, Nombre = x.Nombre }).ToList() ); Actividad model = ActividadBL.GetById(id); ViewBag.ListActividades = ActividadBL.GetList(model.BoletaId); return(View(model)); }
private void btnModificar_Click(object sender, EventArgs e) { if (dgvMarcas.Rows.Count > 0) { long idCatalogo = Convert.ToInt64(dgvMarcas.Rows[dgvMarcas.CurrentCell.RowIndex].Cells["Id"].Value); Catalogo catalogo = CatalogoBL.obtenerCatalogo(idCatalogo, ref error, ref mensaje); if (!error) { FrmNuevaModificarMarca frmNuevaModificarMarca = new FrmNuevaModificarMarca(this, "M"); frmNuevaModificarMarca.modificarMarca(catalogo); frmNuevaModificarMarca.ShowDialog(); } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void llenarCbCiudad() { List <Catalogo> ciudades = CatalogoBL.obtenerTipoCatalogo(3L, ref error, ref mensaje); if (!error) { Catalogo catalogo = new Catalogo(); catalogo.idCatalogo = 0L; catalogo.valor = "Seleccione una ciudad"; ciudades.Insert(0, catalogo); cbCiudad.DataSource = ciudades; cbCiudad.DisplayMember = "valor"; cbCiudad.ValueMember = "idCatalogo"; } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void llenarCbDocumento() { List <Catalogo> documentos = CatalogoBL.obtenerTipoCatalogo(5L, ref error, ref mensaje); if (!error) { Catalogo catalogo = new Catalogo(); catalogo.idCatalogo = 0L; catalogo.valor = "Seleccione un documento"; documentos.Insert(0, catalogo); cbDocumento.DataSource = documentos; cbDocumento.DisplayMember = "valor"; cbDocumento.ValueMember = "idCatalogo"; } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void llenarCbMarca() { List <Catalogo> marcas = CatalogoBL.obtenerTipoCatalogo((long)Constantes.Catalogo.Marca, ref error, ref mensaje); if (!error) { Catalogo catalogo = new Catalogo(); catalogo.idCatalogo = 0L; catalogo.valor = "Seleccione una marca"; marcas.Insert(0, catalogo); cbMarca.DataSource = marcas; cbMarca.DisplayMember = "valor"; cbMarca.ValueMember = "idCatalogo"; } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEliminar_Click(object sender, EventArgs e) { if (dgvModelos.Rows.Count > 0) { DialogResult result = MessageBox.Show("¿Desea eliminar este modelo?", "Remotran", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { CatalogoBL.eliminarCatalogo(Convert.ToInt64(dgvModelos.Rows[dgvModelos.CurrentCell.RowIndex].Cells["Id"].Value), ref error, ref mensaje); if (!error) { MessageBox.Show("Modelo eliminado exitosamente.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ocurrió un error.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("No tiene ningún modelo.", "Remotran", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void CatalogoBL_Departamento_GetList() { var ListCatalogo = CatalogoBL.GetList(CatalogoEnum.Departamento, false); Assert.IsNotNull(ListCatalogo); }