Example #1
0
 // GET: /Pago/Details/5
 public ActionResult Details(int?id)
 {
     if (Function.GetUserLogin())
     {
         if (Function.GetRol())
         {
             if (Function.GetUserRols("Pago/Details"))
             {
                 if (id == null)
                 {
                     return(RedirectToAction("Index"));
                 }
                 tbPago tbPago = db.tbPago.Find(id);
                 if (tbPago == null)
                 {
                     return(RedirectToAction("NotFound", "Login"));
                 }
                 return(View(tbPago));
             }
             else
             {
                 return(RedirectToAction("SinAcceso", "Login"));
             }
         }
         else
         {
             return(RedirectToAction("SinRol", "Login"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
Example #2
0
        public ActionResult CreateTest01([PexAssumeUnderTest] PagoController target, tbPago tbPago)
        {
            ActionResult result = target.Create(tbPago);

            return(result);
            // TODO: agregar aserciones a método PagoControllerTest.CreateTest01(PagoController, tbPago)
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbPago tbPago = db.tbPago.Find(id);

            db.tbPago.Remove(tbPago);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "pago_Id,fact_Codigo,tpa_Id,pago_Totalpagos,pago_Totalcambio,pago_Emisor,pago_Cuenta,pago_FechaVencimiento,pago_Titular_,pago_UsuarioCrea,pago_FechaCrea,pago_UsuarioModifica,pago_FechaModifica")] tbPago tbPago)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbPago).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.fact_Codigo = new SelectList(db.tbFactura, "fact_Codigo", "cja_Codigo", tbPago.fact_Id);
     ViewBag.tpa_Id      = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);
     return(View(tbPago));
 }
Example #5
0
        public ActionResult Create([Bind(Include = "pago_Id,fact_Id,tpa_Id,pago_FechaElaboracion,pago_SaldoAnterior,pago_TotalPago,pago_TotalCambio,pago_Emisor,bcta_Id,pago_FechaVencimiento,pago_Titular,pago_UsuarioCrea,pago_FechaCrea,pago_UsuarioModifica,pago_FechaModifica, pago_EstaImpreso, pago_EstaAnulado")] tbPago tbPago)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var MensajeError          = 0;
                    IEnumerable <object> list = null;
                    list = db.UDP_Vent_tbPago_Insert(tbPago.fact_Id, tbPago.tpa_Id, tbPago.pago_FechaElaboracion, tbPago.pago_SaldoAnterior, tbPago.pago_TotalPago, tbPago.pago_TotalCambio, tbPago.pago_Emisor, tbPago.bcta_Id, tbPago.pago_FechaVencimiento, tbPago.pago_Titular, tbPago.pago_EstaImpreso, tbPago.pago_EstaAnulado);
                    foreach (UDP_Vent_tbPago_Insert_Result pago in list)
                    {
                        MensajeError = pago.MensajeError;
                    }
                    if (MensajeError == -1)
                    {
                        ViewBag.Cliente     = db.tbCliente.ToList();
                        ViewBag.Factura     = db.tbFactura.ToList();
                        ViewBag.FacturaPago = db.V_Vent_FacturaPago.ToList();
                        ViewBag.NotaCredito = db.UDP_Vent_tbNotaCreditoSelect().ToList();
                        ModelState.AddModelError("", "No se pudo agregar el registro");
                        return(View(tbPago));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
                catch (Exception Ex)
                {
                    ViewBag.bcta_Id = new SelectList(db.tbCuentasBanco, "bcta_Id", "bcta_Numero");
                    ViewBag.fact_Id = new SelectList(db.tbFactura, "fact_Id", "fact_Codigo");
                    ViewBag.tpa_Id  = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion");

                    ViewBag.Cliente     = db.tbCliente.ToList();
                    ViewBag.Factura     = db.tbFactura.ToList();
                    ViewBag.FacturaPago = db.V_Vent_FacturaPago.ToList();
                    ViewBag.NotaCredito = db.UDP_Vent_tbNotaCreditoSelect().ToList();
                    ModelState.AddModelError("", "Error al agregar el registro " + Ex.Message.ToString());
                    return(View(tbPago));
                }
            }

            ViewBag.pago_UsuarioCrea     = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioCrea);
            ViewBag.pago_UsuarioModifica = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioModifica);
            ViewBag.bcta_Id     = new SelectList(db.tbCuentasBanco, "bcta_Id", "bcta_Numero", tbPago.bcta_Id);
            ViewBag.fact_Id     = new SelectList(db.tbFactura, "fact_Id", "fact_Codigo", tbPago.fact_Id);
            ViewBag.tpa_Id      = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);
            ViewBag.Factura     = db.tbFactura.ToList();
            ViewBag.Cliente     = db.tbCliente.ToList();
            ViewBag.FacturaPago = db.V_Vent_FacturaPago.ToList();
            return(View(tbPago));
        }
Example #6
0
        // GET: /Pago/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Function.GetUserLogin())
            {
                if (Function.GetRol())
                {
                    if (Function.GetUserRols("Pago/Edit"))
                    {
                        int idUser = 0;

                        List <tbUsuario> User = Function.getUserInformation();
                        foreach (tbUsuario Usuario in User)
                        {
                            idUser = Convert.ToInt32(Usuario.emp_Id);
                        }
                        if (id == null)
                        {
                            return(RedirectToAction("Index"));
                        }
                        tbPago tbPago = db.tbPago.Find(id);
                        if (tbPago == null)
                        {
                            return(RedirectToAction("NotFound", "Login"));
                        }
                        ViewBag.pago_UsuarioCrea     = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioCrea);
                        ViewBag.pago_UsuarioModifica = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioModifica);
                        ViewBag.bcta_Id = new SelectList(db.tbCuentasBanco, "bcta_Id", "bcta_Numero", tbPago.bcta_Id);
                        ViewBag.fact_Id = new SelectList(db.tbFactura, "fact_Id", "fact_Codigo", tbPago.fact_Id);
                        ViewBag.tpa_Id  = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);

                        ViewBag.Cliente        = db.tbCliente.ToList();
                        ViewBag.Factura        = db.tbFactura.ToList();
                        ViewBag.FacturaPago    = db.UDV_Vent_FacturaPagoSelect.ToList();
                        ViewBag.CuponDescuento = db.UDP_Vent_tbCuponDescuentoSelect().ToList();
                        return(View(tbPago));
                    }
                    else
                    {
                        return(RedirectToAction("SinAcceso", "Login"));
                    }
                }
                else
                {
                    return(RedirectToAction("SinRol", "Login"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
Example #7
0
        // GET: /Pago/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbPago tbPago = db.tbPago.Find(id);

            if (tbPago == null)
            {
                return(HttpNotFound());
            }
            return(View(tbPago));
        }
Example #8
0
        // GET: /Pago/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbPago tbPago = db.tbPago.Find(id);

            if (tbPago == null)
            {
                return(HttpNotFound());
            }
            ViewBag.fact_Codigo = new SelectList(db.tbFactura, "fact_Codigo", "cja_Codigo", tbPago.fact_Id);
            ViewBag.tpa_Id      = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);
            return(View(tbPago));
        }
Example #9
0
        // GET: /Pago/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbPago tbPago = db.tbPago.Find(id);

            if (tbPago == null)
            {
                return(HttpNotFound());
            }
            ViewBag.pago_UsuarioCrea     = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioCrea);
            ViewBag.pago_UsuarioModifica = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioModifica);
            ViewBag.bcta_Id     = new SelectList(db.tbCuentasBanco, "bcta_Id", "bcta_Numero", tbPago.bcta_Id);
            ViewBag.fact_Id     = new SelectList(db.tbFactura, "fact_Id", "fact_Codigo", tbPago.fact_Id);
            ViewBag.tpa_Id      = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);
            ViewBag.Cliente     = db.tbCliente.ToList();
            ViewBag.Factura     = db.tbFactura.ToList();
            ViewBag.FacturaPago = db.V_Vent_FacturaPago.ToList();
            return(View(tbPago));
        }
Example #10
0
 public ActionResult Edit([Bind(Include = "pago_Id,fact_Id,tpa_Id,pago_FechaElaboracion,pago_SaldoAnterior,pago_TotalPago,pago_TotalCambio,pago_Emisor,bcta_Id,pago_FechaVencimiento,pago_Titular,pago_UsuarioCrea,pago_FechaCrea,pago_UsuarioModifica,pago_FechaModifica,pago_EstaImpreso, pago_EstaAnulado")] tbPago tbPago)
 {
     if (Function.GetUserLogin())
     {
         if (Function.GetRol())
         {
             if (Function.GetUserRols("Pago/Edit"))
             {
                 int idUser            = 0;
                 List <tbUsuario> User = Function.getUserInformation();
                 foreach (tbUsuario Usuario in User)
                 {
                     idUser = Convert.ToInt32(Usuario.emp_Id);
                 }
                 if (ModelState.IsValid)
                 {
                     try
                     {
                         string MensajeError       = "";
                         IEnumerable <object> list = null;
                         list = db.UDP_Vent_tbPago_Update(tbPago.pago_Id, tbPago.fact_Id, tbPago.tpa_Id, tbPago.pago_FechaElaboracion, tbPago.pago_SaldoAnterior, tbPago.pago_TotalPago, tbPago.pago_TotalCambio, tbPago.pago_Emisor, tbPago.bcta_Id, tbPago.pago_FechaVencimiento, tbPago.pago_Titular, tbPago.nocre_Codigo_cdto_Id, tbPago.pago_UsuarioCrea, tbPago.pago_FechaCrea, Function.GetUser(), Function.DatetimeNow());
                         foreach (UDP_Vent_tbPago_Update_Result pago in list)
                         {
                             if (MensajeError.StartsWith("-1"))
                             {
                                 Function.InsertBitacoraErrores("Pago/Create", MensajeError, "Create");
                                 ModelState.AddModelError("", "No se pudo insertar el registro, favor contacte al administrador.");
                                 return(View(tbPago));
                             }
                             else
                             {
                                 return(RedirectToAction("Index"));
                             }
                         }
                     }
                     catch (Exception Ex)
                     {
                         ModelState.AddModelError("", "Error al actualizar el registro " + Ex.Message.ToString());
                         return(View(tbPago));
                     }
                 }
                 ViewBag.pago_UsuarioCrea     = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioCrea);
                 ViewBag.pago_UsuarioModifica = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbPago.pago_UsuarioModifica);
                 ViewBag.bcta_Id        = new SelectList(db.tbCuentasBanco, "bcta_Id", "bcta_Numero", tbPago.bcta_Id);
                 ViewBag.fact_Id        = new SelectList(db.tbFactura, "fact_Id", "fact_Codigo", tbPago.fact_Id);
                 ViewBag.tpa_Id         = new SelectList(db.tbTipoPago, "tpa_Id", "tpa_Descripcion", tbPago.tpa_Id);
                 ViewBag.Cliente        = db.tbCliente.ToList();
                 ViewBag.Factura        = db.tbFactura.ToList();
                 ViewBag.FacturaPago    = db.UDV_Vent_FacturaPagoSelect.ToList();
                 ViewBag.CuponDescuento = db.UDP_Vent_tbCuponDescuentoSelect().ToList();
                 return(View(tbPago));
             }
             else
             {
                 return(RedirectToAction("SinAcceso", "Login"));
             }
         }
         else
         {
             return(RedirectToAction("SinRol", "Login"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }