Exemplo n.º 1
0
 public ActionResult Editar(Cliente c, FormCollection frm)
 {
     try{
     if (string.IsNullOrEmpty(c.Estado))
     {
         c.Estado = "A";
     }
     c.ExpiraLicencia = DateTime.ParseExact(Request["ExpiraLicencia"].ToString(), "dd-MM-yyyy", null);
     c.Update();
     return RedirectToAction("ver", new { id= c.IdCliente});
                 }
     catch (Exception ex)
     {
         Funciones.LogError(ex);
         return RedirectToAction("Editar", new { id = c.IdCliente });
     }
 }
Exemplo n.º 2
0
        public static List<Cliente> GetAll(string nombre)
        {
            using (RentaCarContext db = new RentaCarContext())
            {
                var cs = new List<Cliente>();
                SqlCommand cb = new SqlCommand("GetClientes");
                SqlParameter pam = new SqlParameter("@nombre", nombre);
                cb.Parameters.Add(pam);
                Cliente c;
                foreach (DataRow  r in db.get_tabla(cb).Rows)
                {
                    c = new Cliente();
                    c.IdCliente = int.Parse(r["IdCliente"].ToString());
                    c.Nombre = r["nombre"].ToString();
                    c.Estado = r["estado"].ToString();
                    c.ExpiraLicencia = DateTime.Parse(r["ExpiraLicencia"].ToString());

                    if (c.Estado == "I")
                    {
                        c.EstadoLargo = "Inactivo";
                    }
                    cs.Add(c);
                }

                return cs;

            }
        }
Exemplo n.º 3
0
 public ActionResult Nuevo()
 {
     try{
     Cliente c = new Cliente();
     ViewData["IdTipoDocumento"] = new SelectList(TipoDocumento.GetAll(), "IdTipodocumento", "Documento");
     ViewData["IdProvincia"] = new SelectList(Provincia.GetAll(), "IdProvincia", "NombreProvincia");
     ViewData["IdMunicipio"] = new SelectList(Municipio.GetAll(), "IdMunicipio", "NombreMunicipio");
     return View(c);
     }
     catch (Exception ex)
     {
         Funciones.LogError(ex);
         return RedirectToAction("index");
     }
 }
Exemplo n.º 4
0
 public ActionResult Nuevo(Cliente c)
 {
     try{
         c.ExpiraLicencia = DateTime.ParseExact(Request["ExpiraLicencia"].ToString(), "dd-MM-yyyy", null);
     c.Insert();
     return RedirectToAction("ver", new { id= c.IdCliente });
                 }
     catch (Exception ex)
     {
         Funciones.LogError(ex);
         return RedirectToAction("nuevo");
     }
 }