예제 #1
0
        public ActionResult DatosBancariosCreate(CuentaBancariasProveedorAlmacenModels IDCuentaBancoP)
        {
            _CatProveedorServicio_Datos ProveedorDatos = new _CatProveedorServicio_Datos();

            try
            {
                if (Token.IsTokenValid())
                {
                    if (ModelState.IsValid)
                    {
                        IDCuentaBancoP.Conexion = Conexion;
                        IDCuentaBancoP.Usuario  = User.Identity.Name;
                        IDCuentaBancoP.Opcion   = 1;
                        ProveedorDatos.ACDatosBancariosProveedorAlmacen(IDCuentaBancoP);
                        if (IDCuentaBancoP.Completado == true)
                        {
                            TempData["typemessage"] = "1";
                            TempData["message"]     = "Los datos se guardaron correctamente.";
                            Token.ResetToken();
                            return(RedirectToAction("DatosBancarios", new { id = IDCuentaBancoP.IDProveedorAlmacen }));
                        }
                        else
                        {
                            IDCuentaBancoP.ListaCmbBancos = ProveedorDatos.ObteneComboCatBancos(IDCuentaBancoP);
                            TempData["typemessage"]       = "2";
                            TempData["message"]           = "Ocurrió un error al intentar guardar los datos. Intente más tarde.";
                            return(View(IDCuentaBancoP));
                        }
                    }
                    else
                    {
                        IDCuentaBancoP.Conexion       = Conexion;
                        IDCuentaBancoP.ListaCmbBancos = ProveedorDatos.ObteneComboCatBancos(IDCuentaBancoP);
                        return(View(IDCuentaBancoP));
                    }
                }
                else
                {
                    return(RedirectToAction("DatosBancarios", new { id = IDCuentaBancoP.IDProveedorAlmacen }));
                }
            }
            catch (Exception)
            {
                IDCuentaBancoP.Conexion       = Conexion;
                IDCuentaBancoP.ListaCmbBancos = ProveedorDatos.ObteneComboCatBancos(IDCuentaBancoP);
                TempData["typemessage"]       = "2";
                TempData["message"]           = "Ocurrio un error al intentar guardar los datos. Contacte a soporte técnico.";
                return(View(IDCuentaBancoP));
            }
        }
 public ActionResult DatosBancarios(string id)
 {
     try
     {
         CuentaBancariasProveedorAlmacenModels CuentasBancarias = new CuentaBancariasProveedorAlmacenModels();
         _CatProveedorAlmacen_Datos            ProveddorDatos   = new _CatProveedorAlmacen_Datos();
         CuentasBancarias.Conexion                    = Conexion;
         CuentasBancarias.IDProveedorAlmacen          = id;
         CuentasBancarias.ListaCuentaProveedorAlmacen = ProveddorDatos.ObtenerCuentasBancarias(CuentasBancarias);
         return(View(CuentasBancarias));
     }
     catch (Exception)
     {
         CuentaBancariasProveedorAlmacenModels CuentasBancarias = new CuentaBancariasProveedorAlmacenModels();
         TempData["typemessage"] = "2";
         TempData["message"]     = "No se puede cargar la vista";
         return(RedirectToAction("Index", "CatProveedor"));
         //return RedirectToAction("Index");
     }
 }
 public ActionResult DatosBancariosCreate(string id)
 {
     try
     {
         Token.SaveToken();
         CuentaBancariasProveedorAlmacenModels Cuenta         = new CuentaBancariasProveedorAlmacenModels();
         _CatProveedorAlmacen_Datos            ProveedorDatos = new _CatProveedorAlmacen_Datos();
         Cuenta.IDProveedorAlmacen = id;
         Cuenta.Conexion           = Conexion;
         Cuenta.ListaCmbBancos     = ProveedorDatos.ObteneComboCatBancos(Cuenta);
         return(View(Cuenta));
     }
     catch (Exception)
     {
         CuentaBancariasProveedorAlmacenModels Cuenta = new CuentaBancariasProveedorAlmacenModels();
         Cuenta.IDProveedorAlmacen = id;
         TempData["typemessage"]   = "2";
         TempData["message"]       = "No se puede cargar la vista";
         return(View(Cuenta));
         //return RedirectToAction("DatosBancarios", new { id = Cuenta.IDProveedorAlmacen });
     }
 }