public Detalle(RendicionDetalle rd) { rdForm = rd; InitializeComponent(); CargarListado(); lblTotal.Text = ObtenerTotal(); }
private void configurarGrilla(DataSet ds) { dgvRendicionesDetalle.Rows.Clear(); List <RendicionDetalle> rendiciones = new List <RendicionDetalle>(); foreach (DataRow row in ds.Tables[0].Rows) { RendicionDetalle rend = new RendicionDetalle(); rend.DataRowToObject(row); rendiciones.Add(rend); dgvRendicionesDetalle.Rows.Add(rend.Cliente, rend.fechaFin, rend.PrecioViaje, rend.PrecioChofer); } }
public ActionResult Index(RendicionDetalle /*RendicionViewModel*/ model) { Session["SelectListP"] = null; if (TempData["Mensaje"] != null) { ViewBag.Mensaje = TempData["Mensaje"].ToString(); } var motivoLN = new MotivoLN(); var tipodocumentoLogicaNegocio = new TipoDocumentoLogicaNegocio(); ViewBag.Categorias = motivoLN.Listar();//productoLN.ListarCategorias(); ViewBag.TipoDocumentos = tipodocumentoLogicaNegocio.Listar(); return(View()); }
private void CargarListado() { try { //obtengo en un dataset todos los roles de la bd DataSet ds = RendicionDetalle.obtenerTodos(rdForm); configurarGrilla(ds); } catch (ErrorConsultaException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSiguiente_Click(object sender, EventArgs e) { DateTime fechaMinSql = new DateTime(1753, 01, 01); DateTime fechaMaxSql = new DateTime(9999, 12, 12); DateTime fecha = Convert.ToDateTime(dtpFecha.Text); List <String> lstErrores = new List <string>(); bool huboErrorDato = false; string error = ""; if (this.txtPorcentaje.Text != "" && this.dtpFecha.Value.ToString("yyyy-MM-dd") != "") { error = Validator.MayorACero(txtPorcentaje.Text, "Porcentaje"); if (error != "") { lstErrores.Add(error); huboErrorDato = true; } else { int num; bool resul = Int32.TryParse(txtPorcentaje.Text, out num); if (resul) { if (int.Parse(txtPorcentaje.Text) > 100) { lstErrores.Add("El porcentaje debe estar entre 0 y 100.\n"); huboErrorDato = true; } } else { lstErrores.Add("El porcentaje debe estar entre 0 y 100.\n"); huboErrorDato = true; } } if (fecha.CompareTo(fechaMinSql) < 0 || fecha.CompareTo(fechaMaxSql) > 0) { lstErrores.Add("La fecha debe estar entre 1/1/1753 y 12/12/9999.\n"); huboErrorDato = true; } /* if (fecha >= DateTime.Now.Date) * { * lstErrores.Add("La fecha debe ser anterior a la del dia de hoy.\n"); * huboErrorDato = true; * } * * if (int.Parse(txtPorcentaje.Text) > 100) * { * lstErrores.Add("El porcentaje debe estar entre 0 y 100.\n"); * huboErrorDato = true; * }*/ if (huboErrorDato) { Validator.mostrarErrores(lstErrores, ""); } else { if (!existe()) { if (ObtenerCantidadViajes() > 0) { RendicionDetalle rd = new RendicionDetalle(); rd.Fecha = this.dtpFecha.Value.ToString("yyyy-MM-dd"); rd.Porcentaje = int.Parse(this.txtPorcentaje.Text); rd.idchofer = int.Parse(this.cmbChofer.SelectedValue.ToString()); rd.IDTurno = int.Parse(this.cmbTurno.SelectedValue.ToString()); Rendicion_Viajes.Detalle reind = new Rendicion_Viajes.Detalle(rd); this.Hide(); reind.Show(); } else { MessageBox.Show("No hay ningun viaje para realizar la rendicion"); } } else { MessageBox.Show("Ya existe una rendicion para ese turno, fecha y chofer"); } } } else { MessageBox.Show("Debe completar todos los campos"); } }