747 lines
27 KiB
C#
747 lines
27 KiB
C#
|
|
using Newtonsoft.Json;
|
|||
|
|
using NLog;
|
|||
|
|
using System;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Data.Entity;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.Configuration;
|
|||
|
|
using System.Web.Mvc;
|
|||
|
|
using ULA.Davivienda.PrendarioModel.Prendario;
|
|||
|
|
using ULA.Davivienda.PrestamoAutos.Commons;
|
|||
|
|
using Ultimus.Interfaces;
|
|||
|
|
using Ultimus.Interfaces.UltimusForm;
|
|||
|
|
using Ultimus.Utilitarios;
|
|||
|
|
using System.Web.Routing;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.ServiceModel;
|
|||
|
|
using MSXML2;
|
|||
|
|
|
|||
|
|
namespace ULA.Davivienda.PrestamoAutos.Controllers
|
|||
|
|
{
|
|||
|
|
public class BaseController : Controller
|
|||
|
|
{
|
|||
|
|
UltimusLogs UltimusLogs = new UltimusLogs("BaseController");
|
|||
|
|
|
|||
|
|
#region Variables QueryString
|
|||
|
|
|
|||
|
|
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 sol_co_solicitud
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
string ret = "0";
|
|||
|
|
if (!string.IsNullOrEmpty(Request.QueryString["sol_co_solicitud"]))
|
|||
|
|
ret = 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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Funciones del Proceso
|
|||
|
|
public string tasa_cambio { get; set; }
|
|||
|
|
|
|||
|
|
public string ConsultarTasaCambio(out string error)
|
|||
|
|
{
|
|||
|
|
string sResult = string.Empty;
|
|||
|
|
Json.JsonConsultarTipoCambio resp = new PrestamoAutos.Json.JsonConsultarTipoCambio();
|
|||
|
|
ControllersWebApi.GlobalAPIController gb = new ControllersWebApi.GlobalAPIController();
|
|||
|
|
error = string.Empty;
|
|||
|
|
|
|||
|
|
|
|||
|
|
string[] _arrUserName = null;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_arrUserName = this.UserID.Split(new char[] { '/' });
|
|||
|
|
|
|||
|
|
resp = gb.ConsultarTasaCambio(new PrestamoAutos.Json.JsonConsultarTipoCambio()
|
|||
|
|
{
|
|||
|
|
Proceso = this.Process,
|
|||
|
|
Usuario = _arrUserName.Length >= 2 ? _arrUserName[1] : string.Empty
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
if (resp.CodigoRespuesta == PrestamoAutos.Json.TipoCodigoRespuesta.EXITOSO.ToString())
|
|||
|
|
sResult = resp.TipoCambioVenta.ToString();
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
error = resp.DescripcionRespuesta;
|
|||
|
|
sResult = "0";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
sResult = "0";
|
|||
|
|
}
|
|||
|
|
return sResult;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int ObtenerTipoAprobacionCaso(string IdSolicitud, out string error)
|
|||
|
|
{
|
|||
|
|
int nResult = 0;
|
|||
|
|
int? _IdSolicitud = null;
|
|||
|
|
error = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_IdSolicitud = int.Parse(IdSolicitud);
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
DatosAprobacion _datosAprobacion = db.DatosAprobacion.Where(e => e.IdSolicitud == _IdSolicitud).FirstOrDefault();
|
|||
|
|
|
|||
|
|
if (_datosAprobacion != null)
|
|||
|
|
nResult = _datosAprobacion.TipoAprobacionCaso.Value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
nResult = 0;
|
|||
|
|
error = ex.Message;
|
|||
|
|
}
|
|||
|
|
return nResult;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool ObtenerAplicaIntegracionCartera(string IdSolicitud, out string error)
|
|||
|
|
{
|
|||
|
|
bool bResult = false;
|
|||
|
|
int? _IdSolicitud = null;
|
|||
|
|
error = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_IdSolicitud = int.Parse(IdSolicitud);
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
Solicitud _Solicitud = db.Solicitud.Where(e => e.IdSolicitud == _IdSolicitud).FirstOrDefault();
|
|||
|
|
|
|||
|
|
if (_Solicitud != null)
|
|||
|
|
bResult = _Solicitud.AplicaIntegracionConCartera ?? false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
bResult = false;
|
|||
|
|
error = ex.Message;
|
|||
|
|
}
|
|||
|
|
return bResult;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool ObtenerSiAplicaCompraTasa(string IdCotizacion, out string error)
|
|||
|
|
{
|
|||
|
|
bool nResult = false;
|
|||
|
|
int? _IdCotizacion = null;
|
|||
|
|
error = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_IdCotizacion = int.Parse(IdCotizacion);
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
Cotizacion _cot = db.Cotizacion.Where(e => e.IdCotizacion == _IdCotizacion).FirstOrDefault();
|
|||
|
|
|
|||
|
|
if (_cot != null)
|
|||
|
|
nResult = _cot.AplicaCompraTasa.Value;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
nResult = false;
|
|||
|
|
error = ex.Message;
|
|||
|
|
}
|
|||
|
|
return nResult;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int? ObtenerAseguradoraSolicitud(string TipoRubroSeguro, string IdCotizacion, out string error)
|
|||
|
|
{
|
|||
|
|
int? nResult = null;
|
|||
|
|
int? _IdCotizacion = null;
|
|||
|
|
error = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
_IdCotizacion = int.Parse(IdCotizacion);
|
|||
|
|
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
SegurosCotizacion segCotizacion = db.SegurosCotizacion
|
|||
|
|
.Include(e => e.RubroSeguro)
|
|||
|
|
.Include("RubroSeguro.TipoRubroSeguro")
|
|||
|
|
.Include("RubroSeguro.Aseguradora")
|
|||
|
|
.Where(e => e.IdCotizacion == _IdCotizacion
|
|||
|
|
&& e.RubroSeguro.TipoRubroSeguro.Descripcion == TipoRubroSeguro).FirstOrDefault();
|
|||
|
|
|
|||
|
|
if (segCotizacion != null)
|
|||
|
|
if (segCotizacion.RubroSeguro != null)
|
|||
|
|
nResult = segCotizacion.RubroSeguro.IdAseguradora;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
nResult = null;
|
|||
|
|
}
|
|||
|
|
return nResult;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Funciones Ultimus
|
|||
|
|
|
|||
|
|
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)
|
|||
|
|
{
|
|||
|
|
Tarea = new UltimusManager().GetTask(Request.Cookies["UserID"].Value, Request.Cookies["TaskID"].Value);
|
|||
|
|
BorrarCookie("UserID");
|
|||
|
|
BorrarCookie("TaskID");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
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) });
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void Initialize(RequestContext requestContext) {
|
|||
|
|
|
|||
|
|
base.Initialize(requestContext);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
public void InitControllers()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
#region Variables Ultimus
|
|||
|
|
|
|||
|
|
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.UrlAdjuntos = new ObtieneParametros().GetValueKeyRegedit("UltimusAttachmentUrl", false);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Variables of process
|
|||
|
|
|
|||
|
|
ViewBag.sol_co_solicitud = sol_co_solicitud;
|
|||
|
|
ViewBag.sol_co_cotizacion = sol_co_cotizacion;
|
|||
|
|
ViewBag.cl_co_cliente = cl_co_cliente;
|
|||
|
|
|
|||
|
|
#region TasaCambio
|
|||
|
|
|
|||
|
|
string error_tasa_cambio = string.Empty;
|
|||
|
|
tasa_cambio = ConsultarTasaCambio(out error_tasa_cambio);
|
|||
|
|
|
|||
|
|
ViewBag.tasa_cambio = tasa_cambio;
|
|||
|
|
ViewBag.error_tasa_cambio = error_tasa_cambio;
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region IdAseguradora
|
|||
|
|
|
|||
|
|
string error_aseguradora = string.Empty;
|
|||
|
|
int? _IdAseguradoraSegAuto = ObtenerAseguradoraSolicitud("AUTO", sol_co_cotizacion, out error_aseguradora);
|
|||
|
|
ViewBag.IdAseguradoSegAuto = _IdAseguradoraSegAuto;
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region AplicaCompraTasa
|
|||
|
|
|
|||
|
|
ViewBag.AplicaCompraTasa = ObtenerSiAplicaCompraTasa(sol_co_cotizacion, out error_aseguradora);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region TipoAprobacionCaso
|
|||
|
|
|
|||
|
|
ViewBag.TipoAprobacionCaso = ObtenerTipoAprobacionCaso(sol_co_solicitud, out error_aseguradora);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Limite Seguros
|
|||
|
|
|
|||
|
|
if (Step == EnumEtapas.EtapaCotizacion || Step == EnumEtapas.EtapaAprobacion1 || Step == EnumEtapas.EtapaAprobacion2 || Step == EnumEtapas.EtapaSeguros || Step == EnumEtapas.EtapaVbModificacionCaratula || Step == EnumEtapas.EtapaVbAprobacionCaratula)
|
|||
|
|
{
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
List<RubroSeguro> rubros = db.RubroSeguro.Include(q => q.TipoRubroSeguro).ToList();
|
|||
|
|
|
|||
|
|
RubroSeguro rubroAutoDefault = rubros.Where(q => q.IdTipoRubroSeguro == (int)EnumTipoRubroSeguro.Auto && q.Default).FirstOrDefault();
|
|||
|
|
if (rubroAutoDefault != null)
|
|||
|
|
{
|
|||
|
|
ViewBag.DefaultIdRubroAuto = rubroAutoDefault.IdRubroSeguro;
|
|||
|
|
ViewBag.DefaultDescRubroAuto = rubroAutoDefault.Descripcion;
|
|||
|
|
ViewBag.DefaultRequeridoRubroAuto = rubroAutoDefault.TipoRubroSeguro.Requerido.ToString().ToLower();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RubroSeguro rubroVidaDefault = rubros.Where(q => q.IdTipoRubroSeguro == (int)EnumTipoRubroSeguro.Vida && q.Default).FirstOrDefault();
|
|||
|
|
if (rubroAutoDefault != null)
|
|||
|
|
{
|
|||
|
|
ViewBag.DefaultIdRubroVida = rubroVidaDefault.IdRubroSeguro;
|
|||
|
|
ViewBag.DefaultDescRubroVida = rubroVidaDefault.Descripcion;
|
|||
|
|
ViewBag.DefaultRequeridoRubroVida = rubroVidaDefault.TipoRubroSeguro.Requerido.ToString().ToLower();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RubroSeguro rubroDesempleoDefault = rubros.Where(q => q.IdTipoRubroSeguro == (int)EnumTipoRubroSeguro.Desempleo && q.Default).FirstOrDefault();
|
|||
|
|
if (rubroDesempleoDefault != null)
|
|||
|
|
{
|
|||
|
|
ViewBag.DefaultIdRubroDesempleo = rubroDesempleoDefault.IdRubroSeguro;
|
|||
|
|
ViewBag.DefaultDescRubroDesempleo = rubroDesempleoDefault.Descripcion;
|
|||
|
|
ViewBag.DefaultRequeridoRubroDesempleo = rubroDesempleoDefault.TipoRubroSeguro.Requerido.ToString().ToLower();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//Marzo 2017 - En caso de que el monto del crédito supere los $55,000 cambie el default de las pólizas de vida y desempleo a INS.
|
|||
|
|
ViewBag.DefaultLimiteCredito = Convert.ToInt32(ConfigurationManager.AppSettings["Seguro.DefaultLimiteCredito"]);
|
|||
|
|
ViewBag.DefaultLimiteCreditoIdMoneda = Convert.ToInt32(ConfigurationManager.AppSettings["Seguro.DefaultLimiteCreditoIdMoneda"]);
|
|||
|
|
RubroSeguro rubroVidaINS = rubros.Where(q => q.IdAseguradora == (int)EnumAseguradora.INS && q.IdTipoRubroSeguro == (int)EnumTipoRubroSeguro.Vida).FirstOrDefault();
|
|||
|
|
if (rubroVidaINS != null)
|
|||
|
|
{
|
|||
|
|
ViewBag.DefaultLimiteCreditoIdRubroVida = rubroVidaINS.IdRubroSeguro;
|
|||
|
|
ViewBag.DefaultLimiteCreditoDescRubroVida = rubroVidaINS.Descripcion;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
RubroSeguro rubroDesempleoINS = rubros.Where(q => q.IdAseguradora == (int)EnumAseguradora.INS && q.IdTipoRubroSeguro == (int)EnumTipoRubroSeguro.Desempleo).FirstOrDefault();
|
|||
|
|
if (rubroDesempleoINS != null)
|
|||
|
|
{
|
|||
|
|
ViewBag.DefaultLimiteCreditoIdRubroDesempleo = rubroDesempleoINS.IdRubroSeguro;
|
|||
|
|
ViewBag.DefaultLimiteCreditoDescRubroDesempleo = rubroDesempleoINS.Descripcion;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Seguros
|
|||
|
|
using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
{
|
|||
|
|
int IdCotizacion = Convert.ToInt32(sol_co_cotizacion);
|
|||
|
|
List<SegurosCotizacion> seguros = db.SegurosCotizacion
|
|||
|
|
.Include(e => e.RubroSeguro)
|
|||
|
|
.Include("RubroSeguro.TipoRubroSeguro")
|
|||
|
|
.Include("RubroSeguro.Aseguradora")
|
|||
|
|
.Where(e => e.IdCotizacion == IdCotizacion).ToList();
|
|||
|
|
foreach (SegurosCotizacion seguro in seguros)
|
|||
|
|
{
|
|||
|
|
if (seguro.RubroSeguro != null)
|
|||
|
|
{
|
|||
|
|
if (seguro.RubroSeguro.TipoRubroSeguro.Descripcion == "AUTO")
|
|||
|
|
ViewBag.IdAseguradoSegAuto = seguro.RubroSeguro.IdAseguradora;
|
|||
|
|
else if (seguro.RubroSeguro.TipoRubroSeguro.Descripcion == "VIDA")
|
|||
|
|
ViewBag.IdAseguradoSegVida = seguro.RubroSeguro.IdAseguradora;
|
|||
|
|
else if (seguro.RubroSeguro.TipoRubroSeguro.Descripcion == "DESEMPLEO")
|
|||
|
|
ViewBag.IdAseguradoSegDesempleo = seguro.RubroSeguro.IdAseguradora;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region AplicaIntegracionCartera
|
|||
|
|
|
|||
|
|
ViewBag.AplicaIntegracionCartera = ObtenerAplicaIntegracionCartera(sol_co_solicitud, out error_aseguradora);
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Leer Variables Esquema
|
|||
|
|
|
|||
|
|
#region Parametros
|
|||
|
|
WSHttpBinding binding = new WSHttpBinding();
|
|||
|
|
binding.Security.Mode = SecurityMode.None;
|
|||
|
|
binding.MaxReceivedMessageSize = int.MaxValue;
|
|||
|
|
binding.MaxBufferPoolSize = int.MaxValue;
|
|||
|
|
|
|||
|
|
binding.CloseTimeout = new TimeSpan(0, 5, 0);
|
|||
|
|
binding.OpenTimeout = new TimeSpan(0, 5, 0);
|
|||
|
|
binding.ReceiveTimeout = new TimeSpan(0, 5, 0);
|
|||
|
|
binding.SendTimeout = new TimeSpan(0, 5, 0);
|
|||
|
|
|
|||
|
|
HttpTransportSecurity security = new HttpTransportSecurity();
|
|||
|
|
security.ClientCredentialType = HttpClientCredentialType.None;
|
|||
|
|
binding.Security.Transport = security;
|
|||
|
|
|
|||
|
|
string UrlIntegration = new ObtieneParametros().GetValueKeyRegedit("UltimusIntegrationLayerUrl", false);
|
|||
|
|
EndpointAddress EndPoint = new EndpointAddress(UrlIntegration);
|
|||
|
|
|
|||
|
|
MSXML2.DOMDocument xmlRespuesta = new DOMDocument();
|
|||
|
|
Ultimus.Interfaces.UltimusIntegration.UltimusNativeTask unt;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Invocacion
|
|||
|
|
using (Ultimus.Interfaces.UltimusIntegration.UltimusIntegrationClient IntClient = new Ultimus.Interfaces.UltimusIntegration.UltimusIntegrationClient(binding, EndPoint))
|
|||
|
|
{
|
|||
|
|
string sError = "";
|
|||
|
|
|
|||
|
|
if (!IntClient.GetUltimusNativeTask(UserID, TaskID, out unt, out sError))
|
|||
|
|
{
|
|||
|
|
throw new Exception(string.Format("{0}:{1}", "Ha ocurrido un error al obtener la información del esquema interno de Ultimus", sError));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Asignacion de Variables
|
|||
|
|
|
|||
|
|
xmlRespuesta.loadXML(unt.XmlData);
|
|||
|
|
MSXML2.IXMLDOMNode NodoVersionMapa = xmlRespuesta.selectSingleNode("//TaskData/Global/VersionMapaProceso");
|
|||
|
|
|
|||
|
|
if (NodoVersionMapa != null)
|
|||
|
|
ViewBag.VersionMapaProceso = NodoVersionMapa.text;
|
|||
|
|
else
|
|||
|
|
ViewBag.VersionMapaProceso = "1";
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#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 MenuManager().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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region QueryString
|
|||
|
|
|
|||
|
|
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}");
|
|||
|
|
|
|||
|
|
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"]);
|
|||
|
|
|
|||
|
|
ViewBag.QueryEncripted = url;
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region Variables of process
|
|||
|
|
|
|||
|
|
//if (Incident != "0" && Incident != "")
|
|||
|
|
//{
|
|||
|
|
// using (PrendarioContext db = new PrendarioContext())
|
|||
|
|
// {
|
|||
|
|
// int incident = Convert.ToInt32(Incident);
|
|||
|
|
// IdSolicitud sol = db.IdSolicitud.Where(q => q.Incidente == 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);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//if (Request.QueryString["sol_co_solicitud"] != null && Request.QueryString["sol_co_solicitud"] != "0")
|
|||
|
|
// ViewBag.QueryEncripted = string.Concat(ViewBag.QueryEncripted, "&sol_co_solicitud=", Request.QueryString["sol_co_solicitud"]);
|
|||
|
|
//if (Request.QueryString["sol_co_cotizacion"] != null && Request.QueryString["sol_co_cotizacion"] != "0")
|
|||
|
|
// ViewBag.QueryEncripted = string.Concat(ViewBag.QueryEncripted, "&sol_co_cotizacion=", Request.QueryString["sol_co_cotizacion"]);
|
|||
|
|
//if (Request.QueryString["cl_co_cliente"] != null && Request.QueryString["cl_co_cliente"] != "0")
|
|||
|
|
// ViewBag.QueryEncripted = string.Concat(ViewBag.QueryEncripted, "&cl_co_cliente=", Request.QueryString["cl_co_cliente"]);
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|