115 lines
4.5 KiB
C#
115 lines
4.5 KiB
C#
|
|
using System;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web.Mvc;
|
|||
|
|
using ULA.Davivienda.PrestamoAutos.Commons;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Web;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
using System.Web.Configuration;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using Ultimus.Utilitarios;
|
|||
|
|
using Ultimus.Interfaces.UltimusForm;
|
|||
|
|
using Ultimus.Interfaces;
|
|||
|
|
using ULA.Davivienda.PrendarioModel.Prendario;
|
|||
|
|
|
|||
|
|
namespace ULA.Davivienda.PrestamoAutos.Controllers
|
|||
|
|
{
|
|||
|
|
public class HomeController : BaseController
|
|||
|
|
{
|
|||
|
|
public ActionResult Index()
|
|||
|
|
{
|
|||
|
|
ActionResult ret = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
LeerTarea();
|
|||
|
|
|
|||
|
|
if (Tarea != null)
|
|||
|
|
{
|
|||
|
|
string QueryString = "{0}?";
|
|||
|
|
QueryString = string.Concat(QueryString, "UserID={1}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&TaskID={2}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&Process={3}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&Step={4}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&Incident={5}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&JobFunction={6}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&UserFullName={7}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&UserEmail={8}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&Supervisor={9}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&SupervisorFullName={10}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&TaskStatus={11}");
|
|||
|
|
QueryString = string.Concat(QueryString, "&Version={12}");
|
|||
|
|
|
|||
|
|
List<StepFormsList> Menulist = new MenuManager().ObtenerFormularios(Tarea.Process, Tarea.Step);
|
|||
|
|
Crypt crypt = new Crypt();
|
|||
|
|
|
|||
|
|
string url = string.Format(QueryString,
|
|||
|
|
Menulist.FirstOrDefault().FormPath,
|
|||
|
|
crypt.EncryptString(Tarea.User),
|
|||
|
|
crypt.EncryptString(Tarea.TaskId),
|
|||
|
|
crypt.EncryptString(Tarea.Process),
|
|||
|
|
crypt.EncryptString(Tarea.Step),
|
|||
|
|
crypt.EncryptString(Tarea.Incident.ToString()),
|
|||
|
|
crypt.EncryptString(Tarea.JobFunction),
|
|||
|
|
crypt.EncryptString(Tarea.UserFullName),
|
|||
|
|
crypt.EncryptString(Tarea.UserEmail),
|
|||
|
|
crypt.EncryptString(Tarea.Supervisor),
|
|||
|
|
crypt.EncryptString(Tarea.SupervisorFullName),
|
|||
|
|
crypt.EncryptString(Tarea.Status.ToString()),
|
|||
|
|
crypt.EncryptString(Tarea.Version.ToString()));
|
|||
|
|
|
|||
|
|
if (Tarea.Incident != 0)
|
|||
|
|
{
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
Solicitud sol = db.Solicitud.Where(q => q.Incidente == Tarea.Incident).FirstOrDefault();
|
|||
|
|
if (sol != null && sol.IdCotizacion != null)
|
|||
|
|
{
|
|||
|
|
url = string.Format("{0}&sol_co_solicitud={1}&sol_co_cotizacion={2}", url, sol.IdSolicitud, sol.IdCotizacion.Value);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ret = Redirect(url);
|
|||
|
|
ViewBag.QueryString = url;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
throw new Exception("Tarea no encontrada");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
Session["ErrorGenerico"] = ex.Message;
|
|||
|
|
ret = RedirectToAction("Error");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return ret;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public ActionResult Error()
|
|||
|
|
{
|
|||
|
|
InitControllers();
|
|||
|
|
return View();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public ActionResult DatosGenerales()
|
|||
|
|
{
|
|||
|
|
InitControllers();
|
|||
|
|
return View();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public string Encrypt(int id)
|
|||
|
|
{
|
|||
|
|
return new Crypt().EncryptString(id.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public ActionResult Logo()
|
|||
|
|
{
|
|||
|
|
string logo = ConfigurationManager.AppSettings["ULA.LogoClient"].ToString();
|
|||
|
|
string baseclient = ConfigurationManager.AppSettings["ULA.LogoClient.baseclient"].ToString();
|
|||
|
|
var content = System.IO.File.ReadAllBytes(Server.MapPath("~/images/" + logo));
|
|||
|
|
return base.File(content, baseclient);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|