Example #1
0
        public ActionResult btnEnviar()
        {
            var per = new MPersona();
            var dir = new MDireccion();


            var user = Request.Form["inUsuario"].ToString();
            var pass = Request.Form["inpPass"].ToString();
            var con  = new ConPG();
            var rol  = ConPG.rolUsuario(ConPG.autenticar(user, pass));

            //con.ingresarPersona(per, dir);
            if (rol == 1)
            {
                //FormsAuthentication.RedirectFromLoginPage(user, false)
                return(View("~\\Views\\Principal\\Principal.cshtml"));
            }
            else
            {
                if (rol == 3 || rol == 4)
                {
                    return(View("~\\Views\\Tickets\\Index.cshtml"));
                }
                else
                {
                    return(View("~\\Views\\Home\\Index.cshtml"));
                }
            }
        }
 public ActionResult guardarTicket(MTicket tick)
 {
     if (ModelState.IsValid)
     {
         ConPG.ingresarTicket(tick);
         return(View("~\\Views\\Tickets\\Index.cshtml"));
     }
     return(View("~\\Views\\Tickets\\nuevoTicket.cshtml", tick));
 }
 public ActionResult guardarPersona(MPersona per)
 {
     if (!ModelState.IsValid)
     {
         return(View("~\\Views\\Register\\IngresoPersona.cshtml", per));
     }
     per.CodDireccion = ConPG.codDireccion();
     ConPG.ingresarPersona(per);
     return(View("~\\Views\\Principal\\Principal.cshtml"));
 }
 public ActionResult guardarDireccion(MDireccion dir)
 {
     if (!ModelState.IsValid)
     {
         return(View("~\\Views\\Register\\IngresoDireccion.cshtml", dir));
     }
     nomComuna     = Request.Form["comunas"].ToString();
     dir.CodComuna = ConPG.codComuna(nomComuna);
     ConPG.ingresarDireccion(dir);
     return(RedirectToAction("IngresoPersona"));
 }
 public ActionResult guardarUsuario(MUsuario user)
 {
     if (ModelState.IsValid)
     {
         ConPG.ingresarUsuario(user);
         return(View("~\\Views\\Principal\\Principal.cshtml"));
     }
     else
     {
         return(PartialView("~\\Views\\Register\\IngresoUsuario.cshtml"));
     }
 }
 public ActionResult Index(string busqIdCliente)
 {
     if (busqIdCliente != null)
     {
         var id      = Convert.ToInt32(busqIdCliente);
         var cliente = new MCliente();
         cliente = ConPG.buscarCliente(id);
         return(View(cliente));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult editarTicket(int?id)
        {
            if (id == null || id.Equals(string.Empty))
            {
                return(View("~\\Views\\Tickets\\Index.cshtml"));
            }
            var tickets = bd.mt_tab_ticket.Find(id);

            if (tickets == null)
            {
                return(View("~\\Views\\Tickets\\Index.cshtml"));
            }
            var TICK = ConPG.editTicket(tickets);

            return(View(TICK));
        }
        public ActionResult asignarRol(MRolUsuario rolUsu)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ConPG.ingresarRolUsua(rolUsu);
                    return(View("~\\Views\\Principal\\Principal.cshtml"));
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(View("~\\Views\\Register\\IngresoRolUsua.cshtml", rolUsu));
        }
        public ActionResult editarTicket(MTicket tickets)
        {
            if (ModelState.IsValid)
            {
                var pg = new ConPG();
                if (pg.updateTicket(tickets) > 0)
                {
                    return(View("~\\Views\\Tickets\\Index.cshtml"));
                }
            }

            /*var ticket = ConPG.editTicket(tickets);
             * var tick = bd.mt_tab_ticket.Find(tickets.codTicket);
             * tick = ticket;
             * if (ModelState.IsValid)
             * {
             *  //bd.Entry(tick).State = System.Data.Entity.EntityState.Modified;
             *  bd.SaveChanges();
             *  return View("~\\Views\\Tickets\\Index.cshtml");
             * }*/
            return(View());
        }