653 lines
No EOL
27 KiB
C#
653 lines
No EOL
27 KiB
C#
using Newtonsoft.Json;
|
|
using NLog;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Web;
|
|
using System.Web.Configuration;
|
|
using System.Web.Mvc;
|
|
|
|
using ULA.Cathay.Credito.Json;
|
|
using ULA.Cathay.CreditoModel.Entidades;
|
|
using Ultimus.Interfaces;
|
|
using Ultimus.Interfaces.UltimusForm;
|
|
using Ultimus.Utilitarios;
|
|
using ULA.Cathay.CreditoModel.DAL.Credito;
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|
using Ultimus.Interfaces.UltimusIntegration;
|
|
using ULA.Cathay.Credito.ControllersWebApi.Aprobaciones;
|
|
|
|
|
|
|
|
namespace ULA.Cathay.Credito.Controllers
|
|
{
|
|
public class BaseController : Controller
|
|
{
|
|
UltimusLogs UltimusLogs = new UltimusLogs("BaseController");
|
|
|
|
private string _IDLogger;
|
|
|
|
public string IDLogger
|
|
{
|
|
get { return _IDLogger; }
|
|
set { _IDLogger = string.Format("INCIDENT {0}|", value); }
|
|
}
|
|
|
|
public string UserID
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["UserID"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["UserID"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string TaskID
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["TaskID"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["TaskID"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string Process
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Process"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["Process"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string Step
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Step"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["Step"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string Incident
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Incident"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["Incident"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string JobFunction
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["JobFunction"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["JobFunction"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string UserFullName
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["UserFullName"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["UserFullName"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string UserEmail
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["UserEmail"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["UserEmail"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string Supervisor
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Supervisor"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["Supervisor"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string SupervisorFullName
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["SupervisorFullName"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["SupervisorFullName"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string TaskStatus
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["TaskStatus"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["TaskStatus"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string Version
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Version"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["Version"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public string TaskUser
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["TaskUser"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["TaskUser"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
public string AssignedToUser
|
|
{
|
|
get
|
|
{
|
|
string ret = string.Empty;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["AssignedToUser"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["AssignedToUser"]);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string sol_co_solicitud
|
|
{
|
|
get
|
|
{
|
|
string ret = "0";
|
|
if (!string.IsNullOrEmpty(Request.QueryString["sol_co_solicitud"]))
|
|
ret = new Crypt().DecryptString(Request.QueryString["sol_co_solicitud"]);
|
|
|
|
|
|
return ret;
|
|
}
|
|
|
|
}
|
|
|
|
public string sol_co_cotizacion
|
|
{
|
|
get
|
|
{
|
|
string ret = "0";
|
|
if (!string.IsNullOrEmpty(Request.QueryString["sol_co_cotizacion"]))
|
|
ret = Request.QueryString["sol_co_cotizacion"];
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string cl_co_cliente
|
|
{
|
|
get
|
|
{
|
|
string ret = "0";
|
|
if (!string.IsNullOrEmpty(Request.QueryString["cl_co_cliente"]))
|
|
ret = Request.QueryString["cl_co_cliente"];
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public string CambioOferta
|
|
{
|
|
get
|
|
{
|
|
string ret = new Crypt().EncryptString("false");
|
|
if (!string.IsNullOrEmpty(Request.QueryString["CambioOferta"]))
|
|
ret = Request.QueryString["CambioOferta"];
|
|
|
|
return ret;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public UltimusNativeTask TareaNativaUltimus = new UltimusNativeTask();
|
|
|
|
|
|
|
|
|
|
public Ultimus.Interfaces.UltimusIntegration.UltimusIncident Tarea
|
|
{
|
|
get
|
|
{
|
|
if (Session["Tarea"] == null)
|
|
|
|
return null;
|
|
else
|
|
return Session["Tarea"] as Ultimus.Interfaces.UltimusIntegration.UltimusIncident;
|
|
}
|
|
set
|
|
{
|
|
Session["Tarea"] = value;
|
|
}
|
|
}
|
|
|
|
public void LeerTarea()
|
|
{
|
|
if (Request.Cookies["UserID"] != null && Request.Cookies["TaskID"] != null)
|
|
{
|
|
|
|
string sError = string.Empty;
|
|
UltimusIntegrationAPIController UltimusIntgration = new UltimusIntegrationAPIController();
|
|
|
|
|
|
try
|
|
{
|
|
|
|
Tarea = UltimusIntgration.GetTask(Request.Cookies["UserID"].Value, Request.Cookies["TaskID"].Value);
|
|
|
|
|
|
|
|
using (UltimusIntegrationClient UltimusClient = new UltimusIntegrationClient(UltimusIntgration.wSHttpBinding, UltimusIntgration.endpointAddress))
|
|
{
|
|
UltimusClient.GetUltimusNativeTask(Request.Cookies["UserID"].Value, Request.Cookies["TaskID"].Value, out TareaNativaUltimus, out sError);
|
|
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(sError))
|
|
throw new Exception(sError);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UltimusLogs.Error(ex);
|
|
}
|
|
|
|
BorrarCookie("UserID");
|
|
BorrarCookie("TaskID");
|
|
}
|
|
}
|
|
|
|
public bool ClearSession
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
if (!string.IsNullOrEmpty(Request.QueryString["ClearSession"]))
|
|
bool.TryParse(Request.QueryString["ClearSession"], out ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
public string tasa_cambio { get; set; }
|
|
|
|
public ActionResult ErrorGenerico
|
|
{
|
|
get { return View("Error"); }
|
|
}
|
|
|
|
private void BorrarCookie(string cookie)
|
|
{
|
|
HttpCookie myCookie = Request.Cookies.Get(cookie);
|
|
if (myCookie != null)
|
|
{
|
|
Request.Cookies.Remove(myCookie.Name);
|
|
myCookie.Expires = DateTime.Now.AddMonths(-1);
|
|
Response.Cookies.Add(myCookie);
|
|
}
|
|
}
|
|
|
|
public RedirectResult RedirectEncrypted(string url)
|
|
{
|
|
Crypt crypt = new Crypt();
|
|
return Redirect(string.Format("{0}?UserID={1}&TaskID={2}&Process={3}&Step={4}&Incident={5}", url, UserID, TaskID, Process, Step, Incident));
|
|
}
|
|
|
|
public RedirectToRouteResult RedirectToActionEncrypted(string ation, string controller)
|
|
{
|
|
Crypt crypt = new Crypt();
|
|
return RedirectToAction(ation, controller, new { UserID = crypt.EncryptString(UserID), TaskID = crypt.EncryptString(TaskID), Process = crypt.EncryptString(Process), Step = crypt.EncryptString(Step), Incident = crypt.EncryptString(Incident) });
|
|
}
|
|
|
|
|
|
public void InitControllers()
|
|
{
|
|
ViewBag.IpAdress = Commons.Utilities.GetIpAdress();
|
|
ViewBag.MachineName = Dns.GetHostName();
|
|
ViewBag.ActivityType = "WORKFLOW";
|
|
ViewBag.HostResponse = Commons.Utilities.GetIpAdress();
|
|
ViewBag.Incident = Incident;
|
|
ViewBag.UserID = UserID;
|
|
ViewBag.TaskId = TaskID;
|
|
ViewBag.Process = Process;
|
|
ViewBag.Step = Step;
|
|
ViewBag.TaskStatus = TaskStatus;
|
|
ViewBag.JobFunction = JobFunction;
|
|
ViewBag.UserFullName = UserFullName;
|
|
ViewBag.UserEmail = UserEmail;
|
|
ViewBag.Supervisor = Supervisor;
|
|
ViewBag.SupervisorFullName = SupervisorFullName;
|
|
ViewBag.Version = Version;
|
|
ViewBag.TaskUser = TaskUser;
|
|
ViewBag.AssignedToUser = AssignedToUser;
|
|
|
|
ViewBag.UrlAdjuntos = new ObtieneParametros().GetValueKeyRegedit("UltimusAttachmentUrl", false);
|
|
|
|
#region Variables of process
|
|
|
|
#region TasaCambio
|
|
|
|
string error_tasa_cambio = string.Empty;
|
|
|
|
#endregion
|
|
|
|
ViewBag.sol_co_solicitud = sol_co_solicitud;
|
|
ViewBag.sol_co_cotizacion = sol_co_cotizacion;
|
|
ViewBag.cl_co_cliente = cl_co_cliente;
|
|
ViewBag.co_solicitud = new Crypt().EncryptString(sol_co_solicitud);
|
|
|
|
ViewBag.tasa_cambio = tasa_cambio;
|
|
ViewBag.error_tasa_cambio = error_tasa_cambio;
|
|
ViewBag.CambioOferta = CambioOferta;
|
|
|
|
|
|
|
|
|
|
CargaDatosEncabezado();
|
|
|
|
#endregion
|
|
|
|
ViewBag.Pipe = "|";
|
|
|
|
try
|
|
{
|
|
Boolean vLocal = false;
|
|
Boolean.TryParse(WebConfigurationManager.AppSettings["ComplementBPM.local"].ToString(), out vLocal);
|
|
if (vLocal)
|
|
{
|
|
StepFormsList[] Menulist = new StepFormsList[1];
|
|
Menulist[0] = new StepFormsList { FormName = "OFFLINE" };
|
|
ViewBag.Menu = Menulist;
|
|
}
|
|
else
|
|
{
|
|
if (Process != string.Empty && Step != string.Empty)
|
|
{
|
|
List<StepFormsList> Menulist = new UltimusFormAPIController().ObtenerFormularios(Process, Step);
|
|
ViewBag.Menu = Menulist;
|
|
}
|
|
else
|
|
{
|
|
StepFormsList[] Menulist = new StepFormsList[1];
|
|
Menulist[0] = new StepFormsList { FormName = "OFFLINE" };
|
|
ViewBag.Menu = Menulist;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UltimusLogs.Error(ex.ToString());
|
|
StepFormsList[] Menulist = new StepFormsList[1];
|
|
Menulist[0] = new StepFormsList { FormName = "OFFLINE" };
|
|
ViewBag.Menu = Menulist;
|
|
}
|
|
|
|
string QueryString = "?";
|
|
QueryString = string.Concat(QueryString, "UserID={0}");
|
|
QueryString = string.Concat(QueryString, "&TaskID={1}");
|
|
QueryString = string.Concat(QueryString, "&Process={2}");
|
|
QueryString = string.Concat(QueryString, "&Step={3}");
|
|
QueryString = string.Concat(QueryString, "&Incident={4}");
|
|
QueryString = string.Concat(QueryString, "&JobFunction={5}");
|
|
QueryString = string.Concat(QueryString, "&UserFullName={6}");
|
|
QueryString = string.Concat(QueryString, "&UserEmail={7}");
|
|
QueryString = string.Concat(QueryString, "&Supervisor={8}");
|
|
QueryString = string.Concat(QueryString, "&SupervisorFullName={9}");
|
|
QueryString = string.Concat(QueryString, "&TaskStatus={10}");
|
|
QueryString = string.Concat(QueryString, "&Version={11}");
|
|
QueryString = string.Concat(QueryString, "&TaskUser={12}");
|
|
QueryString = string.Concat(QueryString, "&AssignedToUser={13}");
|
|
|
|
string url = string.Format(QueryString,
|
|
Request.QueryString["UserID"],
|
|
Request.QueryString["TaskID"],
|
|
Request.QueryString["Process"],
|
|
Request.QueryString["Step"],
|
|
Request.QueryString["Incident"],
|
|
Request.QueryString["JobFunction"],
|
|
Request.QueryString["UserFullName"],
|
|
Request.QueryString["UserEmail"],
|
|
Request.QueryString["Supervisor"],
|
|
Request.QueryString["SupervisorFullName"],
|
|
Request.QueryString["TaskStatus"],
|
|
Request.QueryString["Version"],
|
|
Request.QueryString["TaskUser"],
|
|
Request.QueryString["AssignedToUser"]);
|
|
|
|
ViewBag.QueryEncripted = url;
|
|
ViewBag.LockDevTools = ((new Ultimus.Utilitarios.ObtieneParametros().GetValueKeyRegedit("LockDevTools", false)) == "1");
|
|
|
|
ViewBag.UltimusAttachmentUrl = new ObtieneParametros().GetValueKeyRegedit("UltimusAttachmentUrl", false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public void CargaDatosEncabezado(bool IsHome = false)
|
|
{
|
|
EncabezadoCathayJson encabezado = new EncabezadoCathayJson();
|
|
SolicitudDAL solicitudDal = new SolicitudDAL();
|
|
ClienteDAL ClienteDal = new ClienteDAL();
|
|
OfertaDAL OferaDal = new OfertaDAL();
|
|
SolicitanteDAL SolicitanteDal = new SolicitanteDAL();
|
|
Solicitud solicitud;
|
|
Solicitante SolicitantePrincipal;
|
|
Cliente ClientePrincipal;
|
|
ProcesosDAL ProcesosDal = new ProcesosDAL();
|
|
ControlCarteraDAL ControlCarteraDAL = new ControlCarteraDAL();
|
|
ControlCartera ControlCartera = new ControlCartera();
|
|
DatosGeneralesFormalizacionDAL DatosGeneralesFormalizacionDAL = new DatosGeneralesFormalizacionDAL();
|
|
DatosGeneralesFormalizacion DatosGeneralesFormalizacion = new DatosGeneralesFormalizacion();
|
|
DesembolsoDatosGeneralesDAL DesembolsoDatosGeneralesDal = new DesembolsoDatosGeneralesDAL();
|
|
BitacoraControlAprobacionDAL ContAprobacionDal = new BitacoraControlAprobacionDAL();
|
|
try
|
|
{
|
|
EncabezadoCathayJson Temp_encabezado = null;
|
|
|
|
if (ClearSession || IsHome)
|
|
{
|
|
if (Session["EncabezadoCathay"] != null)
|
|
Session.Remove("EncabezadoCathay");
|
|
}
|
|
|
|
if (Session["EncabezadoCathay"] != null)
|
|
Temp_encabezado = JsonConvert.DeserializeObject<EncabezadoCathayJson>(Session["EncabezadoCathay"].ToString());
|
|
|
|
int IdSolicitud = 0;
|
|
int.TryParse(sol_co_solicitud, out IdSolicitud);
|
|
|
|
|
|
if (IsHome || Temp_encabezado == null || Temp_encabezado.IdSolicitud != IdSolicitud || (!string.IsNullOrEmpty(Temp_encabezado.NombreProceso) && Temp_encabezado.NombreProceso.Trim() != Process))
|
|
{
|
|
|
|
solicitud = (Tarea == null || Tarea.Incident == 0) && IdSolicitud == 0 ? null :
|
|
(IsHome ? solicitudDal.Obtener(Tarea.Incident, Tarea.Process) : solicitudDal.Obtener(IdSolicitud));
|
|
|
|
if (solicitud != null)
|
|
{
|
|
|
|
encabezado.NombreProceso = Process;
|
|
encabezado.IdProceso = ProcesosDal.Obtener(Process).IdProceso;
|
|
|
|
#region Desembolso
|
|
if (encabezado.IdProceso == EnumProcesos.Desembolso)
|
|
{
|
|
var modelDesembolsoDatosGenerales = DesembolsoDatosGeneralesDal.Obtener(IdSolicitud);
|
|
if (modelDesembolsoDatosGenerales != null) {
|
|
encabezado.IdSolicitudCredito = modelDesembolsoDatosGenerales.IdSolicitudCredito;
|
|
}
|
|
|
|
List<BitacoraControlAprobacion> modelBitacoraControlAprobacion= ContAprobacionDal.Obtener(IdSolicitud, EnumEtapas.DE_Inclu_Sol_Desembolso.ToString());
|
|
|
|
if(modelBitacoraControlAprobacion != null && modelBitacoraControlAprobacion.Count > 0){
|
|
encabezado.AplicaCaratulaAprobacionUnica = modelBitacoraControlAprobacion.Where(x => x.IdDecision == EnumDecision.Desembolo_Gestionar_Caratula_Aprobacion_Unica).Any();
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
encabezado.NumIncidente = solicitud.Incidente.HasValue ? solicitud.Incidente.Value : 0;
|
|
solicitud.Oferta = solicitud == null ? null : OferaDal.ObtenerOfertaSolicitud(new Oferta { IdSolicitud = solicitud.IdSolicitud });
|
|
solicitud.Solicitante = solicitud == null ? null : SolicitanteDal.Obtener(solicitud.IdSolicitud);
|
|
|
|
SolicitantePrincipal = solicitud == null || solicitud.Solicitante == null ? null : solicitud.Solicitante.Where(c => c.EsPrincipal == true).FirstOrDefault();
|
|
ClientePrincipal = SolicitantePrincipal != null ? SolicitantePrincipal.Cliente : null;
|
|
|
|
#region AP_Corre_Caratula_Adjuntar_Doc
|
|
if (Step.In(EnumEtapas.AP_Corre_Caratula_Adjuntar_Doc, EnumEtapas.DE_AP_Corre_Caratula_Adjuntar_Doc)) {
|
|
var respAprobacion = new ValidarCondicionesClienteAPIController().ConsultarDatosDecisionCliente(new AprobacionesComite()
|
|
{
|
|
IdSolicitud = solicitud.IdSolicitud,
|
|
UsuarioCreador= UserID,
|
|
Process= Process,
|
|
Step= Step,
|
|
Incident= int.Parse(Incident)
|
|
});
|
|
|
|
if (respAprobacion != null) encabezado.IdCorrigeCaratula = respAprobacion.IdDecision;
|
|
}
|
|
#endregion
|
|
|
|
if (encabezado.IdProceso == EnumProcesos.Formalizacion)
|
|
{
|
|
DatosGeneralesFormalizacion = DatosGeneralesFormalizacionDAL.Obtener(solicitud.IdSolicitud, int.Parse(Incident));
|
|
if (ClientePrincipal.IdTipoTramite == 4 || ClientePrincipal.IdTipoTramite == 1)
|
|
{
|
|
ControlCartera = ControlCarteraDAL.Obtener(solicitud.IdSolicitud);
|
|
encabezado.LineaSAP = ControlCartera.IdLinea;
|
|
encabezado.EsEspecifico = DatosGeneralesFormalizacion.EsEspecifico == null ? false : DatosGeneralesFormalizacion.EsEspecifico;
|
|
encabezado.IdTipoFacilidad = DatosGeneralesFormalizacion.FormalizacionTipoFacilidades == null ? "" : DatosGeneralesFormalizacion.FormalizacionTipoFacilidades.Select(x => x.IdTipoFacilidad.ToString()).Aggregate((x, y) => x.ToString() + "," + y.ToString());
|
|
}
|
|
else
|
|
{
|
|
encabezado.LineaSAP = !string.IsNullOrEmpty(DatosGeneralesFormalizacion.NumLineaCreadaSAP)?DatosGeneralesFormalizacion.NumLineaCreadaSAP:"";
|
|
encabezado.EsEspecifico = DatosGeneralesFormalizacion.EsEspecifico == null ? false : DatosGeneralesFormalizacion.EsEspecifico;
|
|
encabezado.IdTipoFacilidad = DatosGeneralesFormalizacion.FormalizacionTipoFacilidades == null ? "" : DatosGeneralesFormalizacion.FormalizacionTipoFacilidades.Select(x => x.IdTipoFacilidad.ToString()).Aggregate((x, y) => x.ToString() + "," + y.ToString());
|
|
}
|
|
|
|
}
|
|
|
|
encabezado.FechaSolicitud = solicitud.FechaCreacion ?? DateTime.Now;
|
|
encabezado.IdSolicitud = solicitud.IdSolicitud;
|
|
encabezado.IdCategoria = solicitud.Oferta.IdTipoCategoria;
|
|
encabezado.IdSolicitudSAP = DatosGeneralesFormalizacion.Pignoracion_NumOperacion; //solicitud.IdSolicitudSAP;
|
|
encabezado.IdSolicitudProceso = solicitud.IdSolicitudProceso;
|
|
encabezado.EsgarantiaReal = DatosGeneralesFormalizacion.EsGarantiaReal;
|
|
|
|
if (ClientePrincipal != null)
|
|
{
|
|
encabezado.IdCliente = ClientePrincipal.IdCliente;
|
|
encabezado.IdTipoTramite = ClientePrincipal.IdTipoTramite;
|
|
encabezado.IdTipoCliente = ClientePrincipal.IdTipoCliente;
|
|
encabezado.NombreCliente = ClientePrincipal.IdTipoCliente == 1 ? string.Format("{0} {1}", ClientePrincipal.PrimerNombre, ClientePrincipal.PrimerApellido) : ClientePrincipal.RazonSocial;
|
|
encabezado.NumIdentificacion = ClientePrincipal.NumeroIdentificacion;
|
|
encabezado.DescTipoCliente = ClientePrincipal.TipoCliente == null ? null : ClientePrincipal.TipoCliente.Descripcion;
|
|
encabezado.DescTipoTramite = ClientePrincipal.TipoTramite == null ? null : ClientePrincipal.TipoTramite.Descripcion;
|
|
encabezado.IdClasificacionCliente = ClientePrincipal.IdClasificacionCliente == null ? null : ClientePrincipal.IdClasificacionCliente;
|
|
}
|
|
}
|
|
|
|
if (IsHome)
|
|
{
|
|
encabezado.NombreProceso = Tarea.Process;
|
|
encabezado.NumIncidente = Tarea.Incident;
|
|
}
|
|
|
|
if (Session["EncabezadoCathay"] != null)
|
|
Session.Remove("EncabezadoCathay");
|
|
|
|
Session.Add("EncabezadoCathay", JsonConvert.SerializeObject(encabezado));
|
|
|
|
}
|
|
else if (Temp_encabezado != null && Temp_encabezado.IdSolicitud == IdSolicitud)
|
|
{
|
|
encabezado = Temp_encabezado;
|
|
}
|
|
|
|
ViewBag.FechaSolicitud = encabezado == null ? DateTime.Now.ToString("dd-MMMM-yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-ES")) : encabezado.FechaSolicitud.ToString("dd-MMMM-yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-ES"));
|
|
ViewBag.IdCategoria = encabezado == null ? null : encabezado.IdCategoria;
|
|
ViewBag.IdSolicitudSAP = encabezado == null ? null : encabezado.IdSolicitudSAP;
|
|
ViewBag.IdTipoTramite = encabezado == null ? null : encabezado.IdTipoTramite;
|
|
ViewBag.Nombre = encabezado == null ? null : encabezado.NombreCliente;
|
|
ViewBag.Cedula = encabezado == null ? null : encabezado.NumIdentificacion;
|
|
ViewBag.TipoCliente = encabezado == null ? null : encabezado.DescTipoCliente;
|
|
ViewBag.IdCliente = encabezado == null ? 0 : encabezado.IdCliente;
|
|
ViewBag.IdTipoCliente = encabezado == null ? null : encabezado.IdTipoCliente;
|
|
ViewBag.TipoTramite = encabezado == null ? null : encabezado.DescTipoTramite;
|
|
ViewBag.IdSolicitudProceso = encabezado == null ? 0 : encabezado.IdSolicitudProceso;
|
|
ViewBag.IdSolicitud = encabezado == null ? 0 : encabezado.IdSolicitud;
|
|
ViewBag.IdProceso = encabezado == null ? 0 : encabezado.IdProceso;
|
|
ViewBag.IdClasificacionCliente = encabezado == null ? 0 : encabezado.IdClasificacionCliente;
|
|
ViewBag.LineaSAP = encabezado == null ? null : encabezado.LineaSAP;
|
|
ViewBag.EsEspecifico = encabezado == null ? null : encabezado.EsEspecifico;
|
|
ViewBag.IdSolicitudCredito = encabezado == null ? 0 : encabezado.IdSolicitudCredito;
|
|
ViewBag.AplicaCaratulaAprobacionUnica = encabezado == null ? 0 : (encabezado.AplicaCaratulaAprobacionUnica == true) ? 1 : 0;
|
|
ViewBag.IdCorrigeCaratula = encabezado == null ? "" : encabezado.IdCorrigeCaratula.HasValue ? encabezado.IdCorrigeCaratula.ToString() : "";
|
|
ViewBag.IdTipoFacilidad = encabezado == null ? null : encabezado.IdTipoFacilidad;
|
|
ViewBag.EsgarantiaReal = encabezado == null ? null : encabezado.EsgarantiaReal;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
UltimusLogs.Error(ex);
|
|
}
|
|
finally
|
|
{
|
|
encabezado = null;
|
|
solicitudDal = null;
|
|
ClienteDal = null;
|
|
OferaDal = null;
|
|
SolicitanteDal = null;
|
|
solicitud = null;
|
|
SolicitantePrincipal = null;
|
|
ClientePrincipal = null;
|
|
ProcesosDal = null;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
} |