Cambio CRM a la API
This commit is contained in:
@@ -996,7 +996,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8 col-xs-8">
|
<div class="col-md-10 col-xs-10">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordArchivos" href='#collapse_<%# Eval("CveEvento")%>' style="text-decoration: none;">
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#AccordArchivos" href='#collapse_<%# Eval("CveEvento")%>' style="text-decoration: none;">
|
||||||
<%# Eval("Descripcion")%>
|
<%# Eval("Descripcion")%>
|
||||||
@@ -1011,9 +1011,6 @@
|
|||||||
<i class="fa fa-download" ></i>
|
<i class="fa fa-download" ></i>
|
||||||
</asp:LinkButton>
|
</asp:LinkButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-2" style="padding-left: 0px; padding-top: 4px;">
|
|
||||||
<asp:LinkButton ID="LinkDelete" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-xs red " Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" OnClick="EliminarFile" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ using System.Data;
|
|||||||
|
|
||||||
using Extensiones;
|
using Extensiones;
|
||||||
using System.Web.UI.HtmlControls;
|
using System.Web.UI.HtmlControls;
|
||||||
|
using ADSNetLibrary.SIGAPI.Services.CRM;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Request;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Response;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.Ventas.Request;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.Ventas.Response;
|
||||||
|
using MoreLinq;
|
||||||
|
using ADSNetLibrary.SIGAPI.Services;
|
||||||
|
|
||||||
public partial class CRM_Acercamiento : ClsPaginas
|
public partial class CRM_Acercamiento : ClsPaginas
|
||||||
{
|
{
|
||||||
@@ -246,6 +253,19 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
ViewState["CvePS"] = value;
|
ViewState["CvePS"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean TieneCotizacion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (Boolean)ViewState["TieneCotizacion"];
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
ViewState["TieneCotizacion"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
@@ -290,65 +310,61 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
{
|
{
|
||||||
if (CveAcercamiento > 0)
|
if (CveAcercamiento > 0)
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestAcercamiento AcercamientoModel = new RequestAcercamiento(UsuarioActual.CveEmpresa, CveAcercamiento);
|
||||||
if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveAcercamiento: CveAcercamiento) && ObjCRM.DtResultados.Rows.Count > 0)
|
var objAcercamiento = cRMService.GetAceracamientoCRM(AcercamientoModel);
|
||||||
|
if (objAcercamiento.Result.Count > 0)
|
||||||
{
|
{
|
||||||
LblEncabezadoAcercamiento.Text = String.Format("<span class='bold' style='color: #32c5d2;'>{0}:</span> {1}", ObjCRM.DtResultados.FiltroPrimeroValor("TipoProceso").ToUpper(), ObjCRM.DtResultados.FiltroPrimeroValor("NombreAcercamiento").ToUpper());
|
LblEncabezadoAcercamiento.Text = String.Format("<span class='bold' style='color: #32c5d2;'>{0}:</span> {1}", objAcercamiento.Result[0].TipoProceso.ToUpper(), objAcercamiento.Result[0].NombreAcercamiento.ToUpper());
|
||||||
CveTipoProceso = ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso").ToEntero();
|
CveTipoProceso = objAcercamiento.Result[0].CveTipoProceso.ToEntero();
|
||||||
//SECCION DATOS DEL ACERCAMIENTO
|
//SECCION DATOS DEL ACERCAMIENTO
|
||||||
TxtNombreAcercamiento.Text = ObjCRM.DtResultados.FiltroPrimeroValor("NombreAcercamiento");
|
TxtNombreAcercamiento.Text = objAcercamiento.Result[0].NombreAcercamiento;
|
||||||
TxtDescripcion.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Descripcion");
|
TxtDescripcion.Text = objAcercamiento.Result[0].Descripcion;
|
||||||
TxtFechaApertura.Text = ObjCRM.DtResultados.FiltroPrimeroValor("FechaApertura").ToDateTime().ToShortDateString();
|
TxtFechaApertura.Text = objAcercamiento.Result[0].FechaApertura.ToDateTime().ToShortDateString();
|
||||||
TxtFechaCierre.Text = (ObjCRM.DtResultados.FiltroPrimeroValor("FechaCierre") == "") ? "" : ObjCRM.DtResultados.FiltroPrimeroValor("FechaCierre").ToDateTime().ToShortDateString();
|
TxtFechaCierre.Text = (objAcercamiento.Result[0].FechaCierre.ToString() == "") ? "" : objAcercamiento.Result[0].FechaCierre.ToDateTime().ToShortDateString();
|
||||||
TxtImporte.Text = String.Format("{0:C2}", ObjCRM.DtResultados.FiltroPrimeroValor("Importe").ToString().ToDecimal());
|
TxtImporte.Text = String.Format("{0:C2}", objAcercamiento.Result[0].Importe.ToEntero());
|
||||||
TxtComision.Text = String.Format("{0:C2}", ObjCRM.DtResultados.FiltroPrimeroValor("Comision").ToString().ToDecimal());
|
TxtComision.Text = String.Format("{0:C2}", objAcercamiento.Result[0].Comision.ToEntero());
|
||||||
|
DdlProbabilidadAcercamiento.SelectedValueExist(objAcercamiento.Result[0].CveProbabilidadAcercamiento);
|
||||||
DdlProbabilidadAcercamiento.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveProbabilidadAcercamiento"));
|
DdlPrioridad.SelectedValueExist(objAcercamiento.Result[0].Prioridad);
|
||||||
DdlPrioridad.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("Prioridad"));
|
|
||||||
|
|
||||||
CargaDdl();
|
CargaDdl();
|
||||||
//SECCION DATOS DE LA EMPRESA
|
//SECCION DATOS DE LA EMPRESA
|
||||||
DdlEmpresaCRM.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveEmpresaCRM"));
|
DdlEmpresaCRM.SelectedValueExist(objAcercamiento.Result[0].CveEmpresaCRM);
|
||||||
//DdlContactoPrincipal.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveContactoPrincipal"));
|
|
||||||
//SECCION DATOS DEL PROCESO
|
//SECCION DATOS DEL PROCESO
|
||||||
//DdlTipoProceso.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso"));
|
DdlEtapaProceso.SelectedValueExist(objAcercamiento.Result[0].CveEtapaProcesoActual);
|
||||||
DdlEtapaProceso.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveEtapaProcesoActual"));
|
DdlVendedor.SelectedValueExist(objAcercamiento.Result[0].CveVendedor);
|
||||||
DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedor"));
|
DdlMedioCaptacion.SelectedValueExist(objAcercamiento.Result[0].CveMedioCaptacion);
|
||||||
DdlMedioCaptacion.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveMedioCaptacion"));
|
|
||||||
|
|
||||||
//CARGA MODAL CIERRE-CANCELACION
|
//CARGA MODAL CIERRE-CANCELACION
|
||||||
TxtFechaCierreRechazo.Text = (ObjCRM.DtResultados.FiltroPrimeroValor("FechaCierre") == "") ? DateTime.Now.ToShortDateString() : ObjCRM.DtResultados.FiltroPrimeroValor("FechaCierre").ToDateTime().ToShortDateString();
|
TxtFechaCierreRechazo.Text = (objAcercamiento.Result[0].FechaCierre.ToString() == "") ? DateTime.Now.ToShortDateString() : objAcercamiento.Result[0].FechaCierre.ToDateTime().ToShortDateString();
|
||||||
DdlRechazoMotivo.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveRechazoMotivo"));
|
DdlRechazoMotivo.SelectedValueExist(objAcercamiento.Result[0].CveRechazoMotivo);
|
||||||
TxtObservacionRechazo.Text = ObjCRM.DtResultados.FiltroPrimeroValor("ObservacionRechazo");
|
TxtObservacionRechazo.Text = objAcercamiento.Result[0].ObservacionRechazo;
|
||||||
|
|
||||||
//CARGAMOS PARAMETROS
|
//CARGAMOS PARAMETROS
|
||||||
NombreAcercamiento = ObjCRM.DtResultados.FiltroPrimeroValor("NombreAcercamiento").ToUpper();
|
NombreAcercamiento = objAcercamiento.Result[0].NombreAcercamiento.ToUpper();
|
||||||
CveEmpresaCRM = ObjCRM.DtResultados.FiltroPrimeroValor("CveEmpresaCRM").ToEntero();
|
CveEmpresaCRM = objAcercamiento.Result[0].CveEmpresaCRM.ToEntero();
|
||||||
CveVendedorAsignado = ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedor").ToEntero();
|
CveVendedorAsignado = objAcercamiento.Result[0].CveVendedor.ToEntero();
|
||||||
CveContactoPrincipal = (ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso").ToEntero() > 0) ? ObjCRM.DtResultados.FiltroPrimeroValor("CveContactoPrincipal").ToEntero() : -1;
|
CveContactoPrincipal = (objAcercamiento.Result[0].CveTipoProceso.ToEntero() > 0) ? objAcercamiento.Result[0].CveContactoPrincipal.ToEntero() : -1;
|
||||||
|
|
||||||
CveEtapaActual = ObjCRM.DtResultados.FiltroPrimeroValor("CveEtapaProcesoActual").ToEntero();
|
CveEtapaActual = objAcercamiento.Result[0].CveEtapaProcesoActual.ToEntero();
|
||||||
|
|
||||||
|
|
||||||
CveEncuestaProcesoCRM = (ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaProcesoCRM").ToEntero() > 0) ? ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaProcesoCRM").ToEntero() : -1;
|
|
||||||
CveEncuestaAplicadaProceso = (ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaAplicadaProceso").ToEntero() > 0) ? ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaAplicadaProceso").ToEntero() : -1;
|
|
||||||
//CveEtapaBitacoraSeleccionada = CveEtapaActual;
|
|
||||||
|
|
||||||
CvePS = ObjCRM.DtResultados.FiltroPrimeroValor("CvePS").ToEntero();
|
CveEncuestaProcesoCRM = (objAcercamiento.Result[0].CveEncuestaProcesoCRM.ToEntero() > 0) ? objAcercamiento.Result[0].CveEncuestaProcesoCRM.ToEntero() : -1;
|
||||||
|
CveEncuestaAplicadaProceso = (objAcercamiento.Result[0].CveEncuestaAplicadaProceso.ToEntero() > 0) ? objAcercamiento.Result[0].CveEncuestaAplicadaProceso.ToEntero() : -1;
|
||||||
|
|
||||||
|
CvePS = objAcercamiento.Result[0].CvePS.ToEntero();
|
||||||
|
|
||||||
HdfEtapaSeleccionada.Value = CveEtapaActual.ToString();
|
HdfEtapaSeleccionada.Value = CveEtapaActual.ToString();
|
||||||
//INHABILITAMOS CAMPOS QUE NO SE PUEDEN EDITAR
|
//INHABILITAMOS CAMPOS QUE NO SE PUEDEN EDITAR
|
||||||
DdlEmpresaCRM.Enabled = false;
|
DdlEmpresaCRM.Enabled = false;
|
||||||
//DdlTipoProceso.Enabled = false;
|
|
||||||
|
|
||||||
//MOSTRAMOS BOTONES
|
//MOSTRAMOS BOTONES
|
||||||
BtnGuardarAcercamiento.Text = "Actualizar";
|
BtnGuardarAcercamiento.Text = "Actualizar";
|
||||||
BtnGuardarAcercamiento.Visible = true;
|
BtnGuardarAcercamiento.Visible = true;
|
||||||
BtnEliminarAcercamiento.Visible = true;
|
BtnEliminarAcercamiento.Visible = true;
|
||||||
//DivVerBitacoraCompleta.Visible = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Alert("La Empresa solicitada no existe, por favor revise su búsqueda.", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
Alert("La Empresa solicitada no existe, por favor revise su búsqueda.", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||||
@@ -361,7 +377,6 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
CveEncuestaProcesoCRM = -1;
|
CveEncuestaProcesoCRM = -1;
|
||||||
CveEncuestaAplicadaProceso = -1;
|
CveEncuestaAplicadaProceso = -1;
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
|
||||||
|
|
||||||
if (CveAcercamiento > 0)
|
if (CveAcercamiento > 0)
|
||||||
{
|
{
|
||||||
@@ -429,47 +444,53 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
protected void CargaDdl()
|
protected void CargaDdl()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestProbalidadAcercamiento ProbalidadAcercamiento = new RequestProbalidadAcercamiento(UsuarioActual.CveEmpresa, 1);
|
||||||
|
var ObjProbalidadAcercamiento = cRMService.GetProbabilidadAceracamientoCRM(ProbalidadAcercamiento);
|
||||||
|
RequestEmpresasCRM EmpresaCRM = new RequestEmpresasCRM(UsuarioActual.CveEmpresa, -1);
|
||||||
|
var objEmpresaCRM = cRMService.GetEmpresasCRM(EmpresaCRM);
|
||||||
|
RequestMedioCaptacion MedioCaptacion = new RequestMedioCaptacion(UsuarioActual.CveEmpresa);
|
||||||
|
var ObjMedioCaptacion = cRMService.GetMedioCaptacionCRM(MedioCaptacion);
|
||||||
|
|
||||||
if (ObjCRM.GetProbabilidadAcercamiento(UsuarioActual.CveEmpresa, 1))
|
if (ObjProbalidadAcercamiento.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlProbabilidadAcercamiento.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}", CveTipoProceso));
|
DataTable DtProbabilidadAcercamiento = ObjProbalidadAcercamiento.Result.ToDataTable();
|
||||||
|
DdlProbabilidadAcercamiento.DataSource = DtProbabilidadAcercamiento.FiltraParametros(String.Format("CveTipoProceso = {0}", CveTipoProceso));
|
||||||
}
|
}
|
||||||
if (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa))
|
|
||||||
|
|
||||||
|
if (objEmpresaCRM.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlEmpresaCRM.DataSource = ObjCRM.DtResultados;
|
DdlEmpresaCRM.DataSource = objEmpresaCRM.Result;
|
||||||
DdlEmpresaCRM.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlEmpresaCRM.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
}
|
}
|
||||||
//if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa, 1))
|
|
||||||
//{
|
|
||||||
// DdlTipoProceso.DataSource = ObjCRM.DtResultados;
|
if (ObjMedioCaptacion.Result.Count > 0)
|
||||||
// DdlTipoProceso.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
||||||
//}
|
|
||||||
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, 1))
|
|
||||||
{
|
{
|
||||||
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}",CveTipoProceso));
|
DataTable DTMedioCaptacion = ObjMedioCaptacion.Result.ToDataTable();
|
||||||
|
DdlMedioCaptacion.DataSource = DTMedioCaptacion.FiltraParametros(String.Format("CveTipoProceso = {0}", CveTipoProceso));
|
||||||
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
|
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
|
||||||
ObjCRM.Dispose();
|
|
||||||
|
|
||||||
DdlProbabilidadAcercamiento.DataBind();
|
DdlProbabilidadAcercamiento.DataBind();
|
||||||
DdlEmpresaCRM.DataBind();
|
DdlEmpresaCRM.DataBind();
|
||||||
//DdlTipoProceso.DataBind();
|
|
||||||
DdlVendedor.DataBind();
|
DdlVendedor.DataBind();
|
||||||
DdlMedioCaptacion.DataBind();
|
DdlMedioCaptacion.DataBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CargaRechazosMotivos()
|
protected void CargaRechazosMotivos()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
if (ObjCRM.GetRechazoMotivo(UsuarioActual.CveEmpresa, 1, CveTipoProceso))
|
RequestRechazoMotivo RequestRechazoMotivo = new RequestRechazoMotivo(UsuarioActual.CveEmpresa, 1, CveTipoProceso);
|
||||||
|
var objRequestRechazoMotivo = cRMService.GetRechazoMotivoCRM(RequestRechazoMotivo);
|
||||||
|
if (objRequestRechazoMotivo.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlRechazoMotivo.DataSource = ObjCRM.DtResultados;
|
DdlRechazoMotivo.DataSource = objRequestRechazoMotivo.Result;
|
||||||
DdlRechazoMotivo.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlRechazoMotivo.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
|
||||||
DdlRechazoMotivo.DataBind();
|
DdlRechazoMotivo.DataBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,17 +521,19 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void CargaContactos(int CveEmpresaCRM)
|
protected void CargaContactos(int CveEmpresaCRM)
|
||||||
{
|
{
|
||||||
DdlContactoPrincipal.Items.Clear();
|
DdlContactoPrincipal.Items.Clear();
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa);
|
||||||
|
var objcontactoEmpresa = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM);
|
||||||
|
|
||||||
if (ObjCRM.GetContactoEmpresa(CveEmpresaCRM))
|
if (objcontactoEmpresa.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlContactoPrincipal.DataSource = ObjCRM.DtResultados;
|
DdlContactoPrincipal.DataSource = objcontactoEmpresa.Result;
|
||||||
DdlContactoAgenda.DataSource = ObjCRM.DtResultados;
|
DdlContactoAgenda.DataSource = objcontactoEmpresa.Result;
|
||||||
}
|
}
|
||||||
DdlContactoPrincipal.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlContactoPrincipal.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
DdlContactoAgenda.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlContactoAgenda.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
//ObjCRM.Dispose();
|
||||||
|
|
||||||
DdlContactoPrincipal.DataBind();
|
DdlContactoPrincipal.DataBind();
|
||||||
DdlContactoAgenda.DataBind();
|
DdlContactoAgenda.DataBind();
|
||||||
@@ -532,11 +555,13 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
{
|
{
|
||||||
//DDLs
|
//DDLs
|
||||||
DdlEtapaProceso.Items.Clear();
|
DdlEtapaProceso.Items.Clear();
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestEtapaProceso EtapaProceso = new RequestEtapaProceso(UsuarioActual.CveEmpresa, 1, CveTipoProceso);
|
||||||
|
var ObjEtapaProceso = cRMService.GetEtapaProcesoCRM(EtapaProceso);
|
||||||
|
|
||||||
if (ObjCRM.GetEtapaProceso(UsuarioActual.CveEmpresa, CveTipoProceso, CveEstatus: 1))
|
if (ObjEtapaProceso.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DTEtapasProceso = ObjCRM.DtResultados;
|
DTEtapasProceso = ObjEtapaProceso.Result.ToDataTable();
|
||||||
OrdenEtapaActual = DTEtapasProceso.FiltroPrimeroValor("Orden", String.Format("CveEtapaProceso = {0}", CveEtapaActual)).ToEntero();
|
OrdenEtapaActual = DTEtapasProceso.FiltroPrimeroValor("Orden", String.Format("CveEtapaProceso = {0}", CveEtapaActual)).ToEntero();
|
||||||
|
|
||||||
//SI LA ETAPA ES CANCELACION HABILITA MOSTRAR LAS DOS ETAPAS ANTERIORES
|
//SI LA ETAPA ES CANCELACION HABILITA MOSTRAR LAS DOS ETAPAS ANTERIORES
|
||||||
@@ -549,7 +574,6 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
DdlEtapaProceso.DataSource = DTEtapasProceso.FiltraParametros(String.Format("(( Orden >= {0} ) AND ( Orden <= {1} )) OR (CveTipoEtapa = 4)", (OrdenEtapaActual - 1), (OrdenEtapaActual + 1)));
|
DdlEtapaProceso.DataSource = DTEtapasProceso.FiltraParametros(String.Format("(( Orden >= {0} ) AND ( Orden <= {1} )) OR (CveTipoEtapa = 4)", (OrdenEtapaActual - 1), (OrdenEtapaActual + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
|
||||||
DdlEtapaProceso.DataBind();
|
DdlEtapaProceso.DataBind();
|
||||||
}
|
}
|
||||||
protected void DdlEtapaProceso_SelectedIndexChanged(object sender, EventArgs e)
|
protected void DdlEtapaProceso_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@@ -590,16 +614,16 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
if (CveAcercamiento > 0)
|
if (CveAcercamiento > 0)
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
AcercaminetoModel AcercaminetoModel = new AcercaminetoModel();
|
||||||
|
|
||||||
ClsEncuestas ObjDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
ClsEncuestas ObjDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
||||||
//ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
//ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
|
||||||
Boolean HuboError = true;
|
Boolean HuboError = true;
|
||||||
|
|
||||||
String NombreAcercamiento = TxtNombreAcercamiento.Text;
|
String NombreAcercamiento = TxtNombreAcercamiento.Text;
|
||||||
String Descripcion = TxtDescripcion.Text == "" ? "-1" : TxtDescripcion.Text;
|
String Descripcion = TxtDescripcion.Text == "" ? "-1" : TxtDescripcion.Text;
|
||||||
|
|
||||||
int CveEtapaProcesoActualActualizar = DdlEtapaProceso.SelectedValue.ToEntero();
|
int CveEtapaProcesoActualActualizar = DdlEtapaProceso.SelectedValue.ToEntero();
|
||||||
|
|
||||||
int CveContactoPrincipal = DdlContactoPrincipal.SelectedValue.ToEntero();
|
int CveContactoPrincipal = DdlContactoPrincipal.SelectedValue.ToEntero();
|
||||||
int CveVendedor = DdlVendedor.SelectedValue.ToEntero();
|
int CveVendedor = DdlVendedor.SelectedValue.ToEntero();
|
||||||
int CveMedioCaptacion = DdlMedioCaptacion.SelectedValue.ToEntero();
|
int CveMedioCaptacion = DdlMedioCaptacion.SelectedValue.ToEntero();
|
||||||
@@ -629,9 +653,25 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
{
|
{
|
||||||
CveEncuestaAplicadaProceso = GuardaDatosTecnicos(ObjDatosTecnicos, CveEncuestaAplicadaProceso);
|
CveEncuestaAplicadaProceso = GuardaDatosTecnicos(ObjDatosTecnicos, CveEncuestaAplicadaProceso);
|
||||||
}
|
}
|
||||||
|
AcercaminetoModel.CveAcercamiento = CveAcercamiento;
|
||||||
if ((CveEncuestaAplicadaProceso != 0) && ObjCRM.UpdateAcercamiento(CveAcercamiento, CveContactoPrincipal, CveTipoProceso, CveEtapaProcesoActualActualizar, CveVendedor, CveMedioCaptacion, CveProbabilidadAcercamiento,
|
AcercaminetoModel.CveContactoPrincipal = CveContactoPrincipal;
|
||||||
NombreAcercamiento, Descripcion, Importe, Comision, Prioridad, UsuarioActual.CveUsuario, CveEncuestaAplicadaProceso: CveEncuestaAplicadaProceso, FechaApertura: FechaApertura, FechaCierre: FechaCierre, CvePS:DdlPS.SelectedValue.ToEntero()))
|
AcercaminetoModel.CveTipoProceso = CveTipoProceso;
|
||||||
|
AcercaminetoModel.CveEtapaProcesoActual = CveEtapaProcesoActualActualizar;
|
||||||
|
AcercaminetoModel.CveVendedor = CveVendedor;
|
||||||
|
AcercaminetoModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
AcercaminetoModel.CveProbabilidadAcercamiento = CveProbabilidadAcercamiento;
|
||||||
|
AcercaminetoModel.NombreAcercamiento = NombreAcercamiento;
|
||||||
|
AcercaminetoModel.Descripcion = Descripcion;
|
||||||
|
AcercaminetoModel.Importe = Importe;
|
||||||
|
AcercaminetoModel.Comision = Comision;
|
||||||
|
AcercaminetoModel.Prioridad = Prioridad;
|
||||||
|
AcercaminetoModel.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
AcercaminetoModel.CveEncuestaAplicadaProceso = CveEncuestaAplicadaProceso;
|
||||||
|
AcercaminetoModel.FechaApertura = FechaApertura;
|
||||||
|
AcercaminetoModel.FechaCierre = (DateTime)FechaCierre;
|
||||||
|
AcercaminetoModel.CvePS = DdlPS.SelectedValue.ToEntero();
|
||||||
|
|
||||||
|
if (cRMService.AcercamientoUpdate(AcercaminetoModel))
|
||||||
{
|
{
|
||||||
//String MensajeBitacora = (CveEtapaProcesoActualActualizar != CveEtapaActual) ? String.Format("Se actualizó la etapa del acercamiento a {0}.", DTEtapasProceso.FiltroPrimeroValor("EtapaProceso", "CveEtapaProceso = " + CveEtapaProcesoActualActualizar)) : String.Format("Se actualizó el Acercamiento {0} con Vendedor {2} y Contacto Principal {3}.", NombreAcercamiento, DdlTipoProceso.SelectedItem, DdlVendedor.SelectedItem, DdlContactoPrincipal.SelectedValue == "-1" ? "aun no asignado" : DdlContactoPrincipal.SelectedItem.Text);
|
//String MensajeBitacora = (CveEtapaProcesoActualActualizar != CveEtapaActual) ? String.Format("Se actualizó la etapa del acercamiento a {0}.", DTEtapasProceso.FiltroPrimeroValor("EtapaProceso", "CveEtapaProceso = " + CveEtapaProcesoActualActualizar)) : String.Format("Se actualizó el Acercamiento {0} con Vendedor {2} y Contacto Principal {3}.", NombreAcercamiento, DdlTipoProceso.SelectedItem, DdlVendedor.SelectedItem, DdlContactoPrincipal.SelectedValue == "-1" ? "aun no asignado" : DdlContactoPrincipal.SelectedItem.Text);
|
||||||
|
|
||||||
@@ -644,9 +684,6 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
|
||||||
ObjDatosTecnicos.Dispose();
|
ObjDatosTecnicos.Dispose();
|
||||||
|
|
||||||
//CARGA BITACORA
|
//CARGA BITACORA
|
||||||
@@ -669,8 +706,8 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
protected void GuardarCambioEtapa()
|
protected void GuardarCambioEtapa()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
AcercaminetoModel AcercaminetoModel = new AcercaminetoModel();
|
||||||
String NombreAcercamiento = TxtNombreAcercamiento.Text;
|
String NombreAcercamiento = TxtNombreAcercamiento.Text;
|
||||||
String Descripcion = TxtDescripcion.Text == "" ? "-1" : TxtDescripcion.Text;
|
String Descripcion = TxtDescripcion.Text == "" ? "-1" : TxtDescripcion.Text;
|
||||||
|
|
||||||
@@ -696,15 +733,30 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
int CveUsuarioIng = UsuarioActual.CveUsuario;
|
int CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
|
||||||
if (ObjCRM.UpdateAcercamiento(CveAcercamiento, CveContactoPrincipal, CveTipoProceso, CveEtapaProcesoActualActualizar, CveVendedor, CveMedioCaptacion, CveProbabilidadAcercamiento,
|
AcercaminetoModel.CveAcercamiento = CveAcercamiento;
|
||||||
NombreAcercamiento, Descripcion, Importe, Comision, Prioridad, UsuarioActual.CveUsuario, CveEncuestaAplicadaProceso: CveEncuestaAplicadaProceso, FechaApertura: FechaApertura, FechaCierre: FechaCierre, CvePS: DdlPS.SelectedValue.ToEntero()))
|
AcercaminetoModel.CveContactoPrincipal = CveContactoPrincipal;
|
||||||
|
AcercaminetoModel.CveTipoProceso = CveTipoProceso;
|
||||||
|
AcercaminetoModel.CveEtapaProcesoActual = CveEtapaProcesoActualActualizar;
|
||||||
|
AcercaminetoModel.CveVendedor = CveVendedor;
|
||||||
|
AcercaminetoModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
AcercaminetoModel.CveProbabilidadAcercamiento = CveProbabilidadAcercamiento;
|
||||||
|
AcercaminetoModel.NombreAcercamiento = NombreAcercamiento;
|
||||||
|
AcercaminetoModel.Descripcion = Descripcion;
|
||||||
|
AcercaminetoModel.Importe = Importe;
|
||||||
|
AcercaminetoModel.Comision = Comision;
|
||||||
|
AcercaminetoModel.Prioridad = Prioridad;
|
||||||
|
AcercaminetoModel.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
AcercaminetoModel.CveEncuestaAplicadaProceso = CveEncuestaAplicadaProceso;
|
||||||
|
AcercaminetoModel.FechaApertura = FechaApertura;
|
||||||
|
AcercaminetoModel.FechaCierre = (DateTime)FechaCierre;
|
||||||
|
AcercaminetoModel.CvePS = DdlPS.SelectedValue.ToEntero();
|
||||||
|
|
||||||
|
if (cRMService.AcercamientoUpdate(AcercaminetoModel))
|
||||||
{
|
{
|
||||||
CveEtapaActual = CveEtapaProcesoActualActualizar;
|
CveEtapaActual = CveEtapaProcesoActualActualizar;
|
||||||
HdfEtapaSeleccionada.Value = CveEtapaProcesoActualActualizar.ToString();
|
HdfEtapaSeleccionada.Value = CveEtapaProcesoActualActualizar.ToString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
|
||||||
|
|
||||||
//CARGA BITACORA
|
//CARGA BITACORA
|
||||||
CargaEtapasProceso(CveTipoProceso);
|
CargaEtapasProceso(CveTipoProceso);
|
||||||
@@ -731,25 +783,28 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
ClsOIEventos objBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
ClsOIEventos objBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestAcercamiento acercamiento = new RequestAcercamiento(UsuarioActual.CveEmpresa, CveAcercamiento);
|
||||||
|
|
||||||
if (ObjCRM.RemoveAcercamiento(CveAcercamiento, UsuarioActual.CveEmpresa))
|
if (TieneCotizacion)
|
||||||
{
|
{
|
||||||
if (objBitacora.AddEventoBitacora(String.Format("Se eliminó el Acercamiento {0} de tipo {1}", NombreAcercamiento, TipoProceso), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
if (cRMService.AcercamientoDelete(acercamiento))
|
||||||
{
|
{
|
||||||
HuboError = false;
|
if (objBitacora.AddEventoBitacora(String.Format("Se eliminó el Acercamiento {0} de tipo {1}", NombreAcercamiento, TipoProceso), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
||||||
|
{
|
||||||
|
HuboError = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!HuboError)
|
||||||
|
{
|
||||||
|
Alert("El Acercamiento ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion, String.Format("document.location.href=\"/CRM/EmpresaCRM.aspx?CveEmpresaCRM={0}\"", CveEmpresaCRM));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!HuboError)
|
|
||||||
{
|
|
||||||
ObjCRM.Commit();
|
|
||||||
Alert("El Acercamiento ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion, String.Format("document.location.href=\"/CRM/EmpresaCRM.aspx?CveEmpresaCRM={0}\"", CveEmpresaCRM));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ObjCRM.RollBack();
|
Alert("No se puede eliminar el acercamiento porque el prospecto cuenta con cotizaciones/facturaciones previas.", ModExtensiones.TipoMensaje.MsgError);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
|
||||||
objBitacora.Dispose();
|
objBitacora.Dispose();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -811,7 +866,8 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
protected void BtnRegistrarCierreCancelacion_Click(object sender, EventArgs e)
|
protected void BtnRegistrarCierreCancelacion_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
//ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
//ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
|
||||||
//Boolean HuboError = true;
|
//Boolean HuboError = true;
|
||||||
@@ -822,7 +878,16 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
String TituloCierre = DTEtapasProceso.FiltroPrimeroValor("EtapaProceso", "CveTipoEtapa = 4");
|
String TituloCierre = DTEtapasProceso.FiltroPrimeroValor("EtapaProceso", "CveTipoEtapa = 4");
|
||||||
|
|
||||||
if (ObjCRM.UpdateAcercamientoCierre(CveAcercamiento, CveEtapaCierre, CveRechazoMotivo, UsuarioActual.CveUsuario, FechaCierre, Observacion))
|
|
||||||
|
AcercaminetoModel acercamiento = new AcercaminetoModel();
|
||||||
|
acercamiento.CveAcercamiento = CveAcercamiento;
|
||||||
|
acercamiento.CveEtapaProcesoActual = CveEtapaCierre;
|
||||||
|
acercamiento.CveRechazoMotivo = CveRechazoMotivo;
|
||||||
|
acercamiento.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
acercamiento.FechaCierre = FechaCierre;
|
||||||
|
acercamiento.ObservacionRechazo = Observacion;
|
||||||
|
|
||||||
|
if (cRMService.AcercamientoCierreUpdate(acercamiento))
|
||||||
{
|
{
|
||||||
String MensajeBitacora = "";
|
String MensajeBitacora = "";
|
||||||
if (CveEtapaActual == CveEtapaCierre)
|
if (CveEtapaActual == CveEtapaCierre)
|
||||||
@@ -839,7 +904,7 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
|
|
||||||
//if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
//if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
//ObjCRM.Dispose();
|
||||||
//ObjBitacora.Dispose();
|
//ObjBitacora.Dispose();
|
||||||
|
|
||||||
CveEtapaActual = CveEtapaCierre;
|
CveEtapaActual = CveEtapaCierre;
|
||||||
@@ -855,23 +920,27 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void CargaEtapasBitacora()
|
protected void CargaEtapasBitacora()
|
||||||
{
|
{
|
||||||
//CARGA STEP DE PASOS
|
//CARGA STEP DE PASOS
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestEtapaProceso EtapaProceso = new RequestEtapaProceso(UsuarioActual.CveEmpresa, 1, CveTipoProceso);
|
||||||
|
var ObjEtapaProceso = cRMService.GetEtapaProcesoCRM(EtapaProceso);
|
||||||
|
|
||||||
if (ObjCRM.GetEtapaProceso(UsuarioActual.CveEmpresa, CveTipoProceso, CveEstatus: 1))
|
if (ObjEtapaProceso.Result.Count > 0)
|
||||||
{
|
{
|
||||||
TipoProceso = ObjCRM.DtResultados.FiltroPrimeroValor("TipoProceso").ToUpper();
|
DataTable DTTemp = ObjEtapaProceso.Result.ToDataTable();
|
||||||
|
TipoProceso = DTTemp.FiltroPrimeroValor("TipoProceso").ToUpper();
|
||||||
int CveEtapaCierreCancelacion = DTEtapasProceso.FiltroPrimeroValor("CveEtapaProceso", "CveTipoEtapa = 4").ToEntero();
|
int CveEtapaCierreCancelacion = DTEtapasProceso.FiltroPrimeroValor("CveEtapaProceso", "CveTipoEtapa = 4").ToEntero();
|
||||||
|
|
||||||
NumeroEtapasProceso = ObjCRM.DtResultados.FiltraParametros("CveTipoEtapa IN(1,2,3)").Rows.Count;
|
NumeroEtapasProceso = DTTemp.FiltraParametros("CveTipoEtapa IN(1,2,3)").Rows.Count;
|
||||||
//RptTabsEtapasProcesos.DataSource = ObjCRM.DtResultados.FiltraParametros("CveTipoEtapa IN(1,2,3)");
|
//RptTabsEtapasProcesos.DataSource = ObjCRM.DtResultados.FiltraParametros("CveTipoEtapa IN(1,2,3)");
|
||||||
|
|
||||||
if (CveEtapaCierreCancelacion == CveEtapaActual)
|
if (CveEtapaCierreCancelacion == CveEtapaActual)
|
||||||
RptStepsEtapasProceso.DataSource = ObjCRM.DtResultados.FiltraParametros("CveTipoEtapa IN(1,2,4)");
|
RptStepsEtapasProceso.DataSource = DTTemp.FiltraParametros("CveTipoEtapa IN(1,2,4)");
|
||||||
else
|
else
|
||||||
RptStepsEtapasProceso.DataSource = ObjCRM.DtResultados.FiltraParametros("CveTipoEtapa IN(1,2,3)");
|
RptStepsEtapasProceso.DataSource = DTTemp.FiltraParametros("CveTipoEtapa IN(1,2,3)");
|
||||||
|
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
//ObjCRM.Dispose();
|
||||||
//RptTabsEtapasProcesos.DataBind();
|
//RptTabsEtapasProcesos.DataBind();
|
||||||
RptStepsEtapasProceso.DataBind();
|
RptStepsEtapasProceso.DataBind();
|
||||||
//SpanProceso.InnerText = TipoProceso + ":";
|
//SpanProceso.InnerText = TipoProceso + ":";
|
||||||
@@ -1027,19 +1096,6 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
Archivo = null;
|
Archivo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void EliminarFile(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string cveEvento = string.Format("{0}",((LinkButton)sender).CommandArgument);
|
|
||||||
ClsOIEventos ObjEventoBitacora = new ClsOIEventos();
|
|
||||||
ObjEventoBitacora.RemoveAgendaBitacora( cveEvento.ToEntero(), UsuarioActual.CveEmpresa);
|
|
||||||
ObjEventoBitacora.Dispose();
|
|
||||||
UPAddEventoBitacora.Update();
|
|
||||||
|
|
||||||
//RECARGAMOS GRID BITACORA
|
|
||||||
CargaEventoBitacora(HdfEtapaSeleccionada.Value.ToEntero());
|
|
||||||
UPBitacora.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void BtnGuardarEventoBitacora_Click(object sender, EventArgs e)
|
protected void BtnGuardarEventoBitacora_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ClsOIEventos ObjEventoBitacora = new ClsOIEventos();
|
ClsOIEventos ObjEventoBitacora = new ClsOIEventos();
|
||||||
@@ -1059,7 +1115,7 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveEtapaProcesoCRM: CveEtapa))
|
if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveEtapaProcesoCRM: CveEtapa))
|
||||||
{
|
{
|
||||||
if (filemove != "")
|
if (filemove != "")
|
||||||
filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false);
|
filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"Empresas\{0}\OI", UsuarioActual.CveEmpresa));
|
||||||
|
|
||||||
|
|
||||||
TxtEventoDescripcion.Text = "";
|
TxtEventoDescripcion.Text = "";
|
||||||
@@ -1122,9 +1178,6 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
ScriptManager.GetCurrent(this).RegisterPostBackControl(e.Item.FindControl("LinkArchivo")); // Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
|
ScriptManager.GetCurrent(this).RegisterPostBackControl(e.Item.FindControl("LinkArchivo")); // Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
|
||||||
|
|
||||||
((Label)e.Item.FindControl("LblTipoArchivo")).Text = row["Archivo"].ToString().Split('.')[1].ToUpper();
|
((Label)e.Item.FindControl("LblTipoArchivo")).Text = row["Archivo"].ToString().Split('.')[1].ToUpper();
|
||||||
|
|
||||||
((LinkButton)e.Item.FindControl("LinkDelete")).CommandArgument = row["CveEvento"].ToString();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1401,7 +1454,7 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
return _CveEncuestaAplicada;
|
return _CveEncuestaAplicada;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "MUESTRA UBICACION GEOGRAFICA"
|
#region "MUESTRA UBICACION GEOGRAFICA"
|
||||||
protected void LnkVerUbicacion_Click(object sender, EventArgs e)
|
protected void LnkVerUbicacion_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -1416,9 +1469,13 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void CargaImagenes()
|
protected void CargaImagenes()
|
||||||
{
|
{
|
||||||
var ObjCRM = new ClsCRM();
|
var ObjCRM = new ClsCRM();
|
||||||
if (ObjCRM.GetImagenesAcercamiento(CveAcercamiento))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestImagenesAcercamiento ImagenesAcercamiento = new RequestImagenesAcercamiento(CveAcercamiento);
|
||||||
|
|
||||||
|
var objImagenesAcercamiento = cRMService.ImagenesAcercamientoGet(ImagenesAcercamiento);
|
||||||
|
if (objImagenesAcercamiento.Result.Count > 0)
|
||||||
{
|
{
|
||||||
RptFotos.DataSource = ObjCRM.DtResultados;
|
RptFotos.DataSource = objImagenesAcercamiento.Result;
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
ObjCRM.Dispose();
|
||||||
RptFotos.DataBind();
|
RptFotos.DataBind();
|
||||||
@@ -1429,6 +1486,9 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
bool TieneError = false;
|
bool TieneError = false;
|
||||||
var ObjCRM = new ClsCRM();
|
var ObjCRM = new ClsCRM();
|
||||||
ObjCRM.IniciaTransacSQL();
|
ObjCRM.IniciaTransacSQL();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestImagenesAcercamiento ImagenesAcercamiento = new RequestImagenesAcercamiento(CveAcercamiento, UsuarioActual.CveEmpresa, CveEmpresaCRM, -1, "", TxtTituloImagen.Text, TxtDescripcionImagen.Text, "-1", UsuarioActual.CveUsuario);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var item in TxtUpFotos.getfiles().Archivos)
|
foreach (var item in TxtUpFotos.getfiles().Archivos)
|
||||||
@@ -1444,11 +1504,11 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CveArchivo = ObjCRM.AddImagenAcercamiento("", TxtTituloImagen.Text, TxtDescripcionImagen.Text, UsuarioActual.CveUsuario, CveEmpresaCRM, CveAcercamiento, UsuarioActual.CveEmpresa);
|
int CveArchivo = cRMService.ImagenesAcercamientoAdd(ImagenesAcercamiento).ToEntero();
|
||||||
if ((CveArchivo > 0))
|
if ((CveArchivo > 0))
|
||||||
{
|
{
|
||||||
string NombreNuevo = string.Format("{0}{1}", CveArchivo, FileExtension);
|
string NombreNuevo = string.Format("{0}{1}", CveArchivo, FileExtension);
|
||||||
string DirectorioNuevo = string.Format("{0}Acercamientos\\{1}\\Imagenes\\", UsuarioActual.Empresa.Ruta, CveAcercamiento);
|
string DirectorioNuevo = string.Format("{0}\\Empresas\\{1}\\Acercamientos\\{2}\\Imagenes\\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CveAcercamiento);
|
||||||
if (!Directory.Exists(DirectorioNuevo))
|
if (!Directory.Exists(DirectorioNuevo))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(DirectorioNuevo);
|
Directory.CreateDirectory(DirectorioNuevo);
|
||||||
@@ -1456,7 +1516,9 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
DirectorioNuevo = DirectorioNuevo + NombreNuevo;
|
DirectorioNuevo = DirectorioNuevo + NombreNuevo;
|
||||||
var DirectorioViejo = string.Format("{0}Temp\\{1}", AppDomain.CurrentDomain.BaseDirectory, item.filename);
|
var DirectorioViejo = string.Format("{0}Temp\\{1}", AppDomain.CurrentDomain.BaseDirectory, item.filename);
|
||||||
|
|
||||||
if (ObjCRM.UpdateImagenAcercamiento(CveArchivo, NombreNuevo, TxtTituloImagen.Text, TxtDescripcionImagen.Text))
|
RequestImagenesAcercamiento ImagenesAcercamientoUpdate = new RequestImagenesAcercamiento(CveAcercamiento, UsuarioActual.CveEmpresa, CveEmpresaCRM, CveArchivo, NombreNuevo, TxtTituloImagen.Text, TxtDescripcionImagen.Text);
|
||||||
|
|
||||||
|
if (cRMService.ImagenesAcercamientoUpdate(ImagenesAcercamientoUpdate))
|
||||||
{
|
{
|
||||||
File.Move(DirectorioViejo, DirectorioNuevo);
|
File.Move(DirectorioViejo, DirectorioNuevo);
|
||||||
}
|
}
|
||||||
@@ -1504,7 +1566,10 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
if (CveArchivo > 0)
|
if (CveArchivo > 0)
|
||||||
{
|
{
|
||||||
var ObjCRM = new ClsCRM();
|
var ObjCRM = new ClsCRM();
|
||||||
bool Elimino = ObjCRM.RemoveImagenesAcercamiento(CveArchivo);
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestImagenesAcercamiento ImagenesAcercamiento = new RequestImagenesAcercamiento(-1, CveArchivo: CveArchivo);
|
||||||
|
|
||||||
|
bool Elimino = cRMService.ImagenesAcercamientoDelete(ImagenesAcercamiento);
|
||||||
ObjCRM.Dispose();
|
ObjCRM.Dispose();
|
||||||
|
|
||||||
if (Elimino)
|
if (Elimino)
|
||||||
@@ -1522,9 +1587,14 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void CargaCotizaciones()
|
protected void CargaCotizaciones()
|
||||||
{
|
{
|
||||||
ClsVentas ObjVentas = new ClsVentas();
|
ClsVentas ObjVentas = new ClsVentas();
|
||||||
if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "Cot", "-1", -1, "-1", -1, -1, -1, -1, "-1", "-1", "-1", CveEmpresaCRM: CveEmpresaCRM, CveAcercamientoCRM: CveAcercamiento, CveUsuarioConsulta: UsuarioActual.CveUsuario))
|
IVentaService ventaService = new VentaService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestVentas requestVentas = new RequestVentas(UsuarioActual.CveEmpresa, TipoDocto: "Cot", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta: UsuarioActual.CveUsuario, CveAcercamientoCRM: CveAcercamiento);
|
||||||
|
var objVentas = ventaService.GetVentas(requestVentas);
|
||||||
|
|
||||||
|
if (objVentas.IsSuccess)
|
||||||
{
|
{
|
||||||
GvCotizacion.DataSource = ObjVentas.DtResultados;
|
GvCotizacion.DataSource = objVentas.Result;
|
||||||
|
TieneCotizacion = objVentas.Result.Count > 0;
|
||||||
}
|
}
|
||||||
ObjVentas.Dispose();
|
ObjVentas.Dispose();
|
||||||
GvCotizacion.DataBind();
|
GvCotizacion.DataBind();
|
||||||
@@ -1549,9 +1619,14 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void CargaGastos()
|
protected void CargaGastos()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
if (ObjCRM.GetAcercamientosGastos(CveAcercamiento))
|
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestAcermientoGastos AcermientoGastos = new RequestAcermientoGastos(CveAcercamiento);
|
||||||
|
|
||||||
|
var objAcermientoGastos = cRMService.AcercamientosGastosGet(AcermientoGastos);
|
||||||
|
if (objAcermientoGastos.Result.Count > 0)
|
||||||
{
|
{
|
||||||
GvGastos.DataSource = ObjCRM.DtResultados;
|
GvGastos.DataSource = (objAcermientoGastos.Result;
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
ObjCRM.Dispose();
|
||||||
GvGastos.DataBind();
|
GvGastos.DataBind();
|
||||||
@@ -1576,10 +1651,11 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
protected void BtnAgregarGastoModal_Click(object sender, EventArgs e)
|
protected void BtnAgregarGastoModal_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
if(!Actualizar)
|
RequestAcermientoGastos AcermientoGastos = new RequestAcermientoGastos(CveAcercamiento, -1, TxtDescripcionGasto.Text, TxtImporteGasto.Text.ToDecimal(), UsuarioActual.CveUsuario);
|
||||||
|
if (!Actualizar)
|
||||||
{
|
{
|
||||||
if (ObjCRM.AddAcercamientosGastos(CveAcercamiento, TxtDescripcionGasto.Text, TxtImporteGasto.Text.ToDecimal(), UsuarioActual.CveUsuario))
|
if (cRMService.AcercamientosGastosAdd(AcermientoGastos))
|
||||||
{
|
{
|
||||||
CargaGastos();
|
CargaGastos();
|
||||||
|
|
||||||
@@ -1593,7 +1669,7 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ObjCRM.UpdateAcercamientosGastos(CveAcercamientoGasto, TxtDescripcionGasto.Text, TxtImporteGasto.Text.ToDecimal()))
|
if (cRMService.AcercamientosGastosUpdate(AcermientoGastos))
|
||||||
{
|
{
|
||||||
CargaGastos();
|
CargaGastos();
|
||||||
|
|
||||||
@@ -1647,10 +1723,11 @@ public partial class CRM_Acercamiento : ClsPaginas
|
|||||||
{
|
{
|
||||||
|
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||||
CveAcercamientoGasto = GvRow.DataKey("CveAcercamientoGasto").ToEntero();
|
CveAcercamientoGasto = GvRow.DataKey("CveAcercamientoGasto").ToEntero();
|
||||||
|
RequestAcermientoGastos AcermientoGastos = new RequestAcermientoGastos(CveAcercamiento, CveAcercamientoGasto: CveAcercamientoGasto);
|
||||||
if (ObjCRM.RemoveAcercamientosGastos(CveAcercamientoGasto))
|
if (cRMService.AcercamientosGastosDelete(AcermientoGastos))
|
||||||
{
|
{
|
||||||
CargaGastos();
|
CargaGastos();
|
||||||
Alert("Gasto eliminado Correctamente", ModExtensiones.TipoMensaje.MsgInformacion);
|
Alert("Gasto eliminado Correctamente", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ using System.Web.UI.WebControls;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using GemBox.Spreadsheet;
|
using GemBox.Spreadsheet;
|
||||||
using Extensiones;
|
using Extensiones;
|
||||||
|
using ADSNetLibrary.SIGAPI.Services.CRM;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Request;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Response;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using MoreLinq;
|
||||||
|
|
||||||
public partial class CRM_CatEmpresasCRM : ClsPaginas
|
public partial class CRM_CatEmpresasCRM : ClsPaginas
|
||||||
{
|
{
|
||||||
@@ -44,40 +49,60 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
|
|||||||
|
|
||||||
protected void CargaDatos()
|
protected void CargaDatos()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
|
||||||
|
|
||||||
if (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveMedioCaptacion: DdlMedioCaptacion.SelectedValue.ToEntero()) && ObjCRM.DtResultados.Rows.Count > 0)
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestEmpresasCRM parametros = new RequestEmpresasCRM(UsuarioActual.CveEmpresa, -1, CveMedioCaptacion: DdlMedioCaptacion.SelectedValue.ToEntero());
|
||||||
|
var objServicio = cRMService.GetEmpresasCRM(parametros);
|
||||||
|
if (objServicio.Result.Count > 0)
|
||||||
{
|
{
|
||||||
TmpDT = ObjCRM.DtResultados;
|
GVDatos.DataSource = objServicio.Result;
|
||||||
GVDatos.DataSource = TmpDT;
|
TmpDT = objServicio.Result.ToDataTable();
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
//if (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveMedioCaptacion: DdlMedioCaptacion.SelectedValue.ToEntero()) && ObjCRM.DtResultados.Rows.Count > 0)
|
||||||
|
//{
|
||||||
|
// TmpDT = ObjCRM.DtResultados;
|
||||||
|
// GVDatos.DataSource = TmpDT;
|
||||||
|
//}
|
||||||
|
//ObjCRM.Dispose();
|
||||||
GVDatos.DataBind();
|
GVDatos.DataBind();
|
||||||
UPDatos.Update();
|
UPDatos.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CargaMediosCaptacion()
|
protected void CargaMediosCaptacion()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestMedioCaptacion MedioCaptacion = new RequestMedioCaptacion(UsuarioActual.CveEmpresa, 1);
|
||||||
|
var ObjMedioCaptacion = cRMService.GetMedioCaptacionCRM(MedioCaptacion);
|
||||||
|
|
||||||
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, 1))
|
if (ObjMedioCaptacion.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}",DdlTipoProceso.SelectedValue));
|
DataTable DTMedioCaptacion = ObjMedioCaptacion.Result.ToDataTable();
|
||||||
|
DdlMedioCaptacion.DataSource = DTMedioCaptacion.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue));
|
||||||
DdlMedioCaptacion.DataBind();
|
DdlMedioCaptacion.DataBind();
|
||||||
DdlMedioCaptacion.Items.Insert(0, new ListItem("Todos", "-1"));
|
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
|
||||||
|
//if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, 1))
|
||||||
|
//{
|
||||||
|
// DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}",DdlTipoProceso.SelectedValue));
|
||||||
|
// DdlMedioCaptacion.DataBind();
|
||||||
|
// DdlMedioCaptacion.Items.Insert(0, new ListItem("Todos", "-1"));
|
||||||
|
//}
|
||||||
|
//ObjCRM.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CargaTipoProcesos()
|
protected void CargaTipoProcesos()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestTipoProceso tipoProceso = new RequestTipoProceso(UsuarioActual.CveEmpresa);
|
||||||
|
var ObjTipoProceso = cRMService.GetTipoProcesoCRM(tipoProceso);
|
||||||
|
|
||||||
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa))
|
if (ObjTipoProceso.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlTipoProceso.DataSource = ObjCRM.DtResultados;
|
DdlTipoProceso.DataSource = ObjTipoProceso.Result;
|
||||||
|
DdlTipoProceso.DataBind();
|
||||||
}
|
}
|
||||||
DdlTipoProceso.DataBind();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -85,24 +110,30 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
|
|||||||
protected void GVDatos_RowDeleting(object sender, GridViewDeleteEventArgs e)
|
protected void GVDatos_RowDeleting(object sender, GridViewDeleteEventArgs e)
|
||||||
{
|
{
|
||||||
int CveEmpresaCRM = GVDatos.Rows[e.RowIndex].DataKey("CveEmpresaCRM").ToEntero();
|
int CveEmpresaCRM = GVDatos.Rows[e.RowIndex].DataKey("CveEmpresaCRM").ToEntero();
|
||||||
Boolean HuboError = true;
|
//Boolean HuboError = true;
|
||||||
|
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestContactoEmpresaCRM ContactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM);
|
||||||
|
RequestEmpresasCRM EmpresasCRM = new RequestEmpresasCRM(-1, CveEmpresaCRM);
|
||||||
|
RequestAcercamiento aceramientoGet = new RequestAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM);
|
||||||
|
var objAcercamiento = cRMService.GetAceracamientoCRM(aceramientoGet);
|
||||||
|
|
||||||
ObjCRM.IniciaTransacSQL();
|
|
||||||
|
|
||||||
if (ObjCRM.RemoveContactoEmpresa(-1, CveEmpresaCRM))
|
if (objAcercamiento.Result.Count == 0)
|
||||||
{
|
{
|
||||||
if (ObjCRM.RemoveEmpresaCRM(CveEmpresaCRM))
|
if (cRMService.EmpresasCRMContactoDelete(ContactoEmpresaCRM))
|
||||||
{
|
{
|
||||||
HuboError = false;
|
if (cRMService.EmpresasCRMDelete(EmpresasCRM))
|
||||||
Alert("La Empresa ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
|
{
|
||||||
|
//HuboError = false;
|
||||||
|
Alert("La Empresa ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
{
|
||||||
|
Alert("No se puede eliminar la empresa porque el prospecto cuenta con cotizaciones/facturaciones previa", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||||
ObjCRM.Dispose();
|
}
|
||||||
CargaDatos();
|
CargaDatos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,12 +183,15 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
|
|||||||
if( TxtExcel.getfiles().Archivos.Count > 0 )
|
if( TxtExcel.getfiles().Archivos.Count > 0 )
|
||||||
{
|
{
|
||||||
Archivo file = TxtExcel.getfiles().Archivos[0];
|
Archivo file = TxtExcel.getfiles().Archivos[0];
|
||||||
string Directorio = Server.MapPath("~") + file.path;
|
string Directorio = Server.MapPath("~") + file.patch;
|
||||||
|
|
||||||
DataTable dt = ReadExcelFile(Directorio + file.filename, true);
|
DataTable dt = ReadExcelFile(Directorio + file.filename, true);
|
||||||
DataRowCollection Rows = dt.Rows;
|
DataRowCollection Rows = dt.Rows;
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
ObjCRM.IniciaTransacSQL();
|
RequestMedioCaptacion RequestMedioCaptacion = new RequestMedioCaptacion(UsuarioActual.CveEmpresa);
|
||||||
|
var ObjMedioCaptacion = cRMService.GetMedioCaptacionCRM(RequestMedioCaptacion);
|
||||||
|
EmpresasCRMModel cRMModel = new EmpresasCRMModel();
|
||||||
|
|
||||||
bool TieneError = false;
|
bool TieneError = false;
|
||||||
|
|
||||||
foreach (DataRow row in Rows)
|
foreach (DataRow row in Rows)
|
||||||
@@ -178,9 +212,10 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
|
|||||||
int CveMedioCaptacion = -1;
|
int CveMedioCaptacion = -1;
|
||||||
if (MedioCaptacion != "" || Agente != "") {
|
if (MedioCaptacion != "" || Agente != "") {
|
||||||
|
|
||||||
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa))
|
if (ObjMedioCaptacion.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DataRow MediosCaptacion = ObjCRM.DtResultados.FiltroPrimero(String.Format("MedioCaptacion = '{0}'",MedioCaptacion));
|
DataTable tempMedio = ObjMedioCaptacion.Result.ToDataTable();
|
||||||
|
DataRow MediosCaptacion = tempMedio.FiltroPrimero(String.Format("MedioCaptacion = '{0}'",MedioCaptacion));
|
||||||
if(MediosCaptacion != null)
|
if(MediosCaptacion != null)
|
||||||
{
|
{
|
||||||
CveMedioCaptacion = MediosCaptacion["CveMedioCaptacion"].ToString().ToEntero();
|
CveMedioCaptacion = MediosCaptacion["CveMedioCaptacion"].ToString().ToEntero();
|
||||||
@@ -228,24 +263,30 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
|
|||||||
TieneError = true;
|
TieneError = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cRMModel.Empresa = NombreEmpresa;
|
||||||
TieneError = (!(ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, -1, CveVendedor, CveSubProyecto, Mail, CveGiro) > 0));
|
cRMModel.RFC = RFC;
|
||||||
|
cRMModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
cRMModel.CveEmpresa = UsuarioActual.CveEmpresa;
|
||||||
|
cRMModel.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
cRMModel.CveEncuestaAplicada = -1;
|
||||||
|
cRMModel.CveVendedorAsignado = CveVendedor;
|
||||||
|
cRMModel.CveSubProyecto = CveSubProyecto;
|
||||||
|
cRMModel.Correo = Mail;
|
||||||
|
cRMModel.CveGiroClasificacion = CveGiro;
|
||||||
|
long CveEmpresaCRM = cRMService.EmpresasCRMAdd(cRMModel).ToEntero();
|
||||||
|
TieneError = CveEmpresaCRM < 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TieneError)
|
if (TieneError)
|
||||||
{
|
{
|
||||||
ObjCRM.RollBack();
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
ObjCRM.Commit();
|
|
||||||
Alert("Prospectos agregados correctamente");
|
Alert("Prospectos agregados correctamente");
|
||||||
TxtExcel.Text = "";
|
TxtExcel.Text = "";
|
||||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivCargasMasivas"));
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivCargasMasivas"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ using System.Web.UI;
|
|||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using ADSNetLibrary.SIGAPI.Services.CRM;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Request;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.CRM.Response;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.Ventas.Request;
|
||||||
|
using ADSNetLibrary.SIGAPI.Models.Ventas.Response;
|
||||||
using Extensiones;
|
using Extensiones;
|
||||||
|
using MoreLinq;
|
||||||
|
using ADSNetLibrary.SIGAPI.Services;
|
||||||
|
|
||||||
public partial class CRM_EmpresaCRM : ClsPaginas
|
public partial class CRM_EmpresaCRM : ClsPaginas
|
||||||
{
|
{
|
||||||
@@ -265,8 +271,11 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
ClsEncuestas ObjDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
ClsEncuestas ObjDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
||||||
|
|
||||||
Boolean HuboError = false;
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
EmpresasCRMModel cRMModel = new EmpresasCRMModel();
|
||||||
|
ResponseContactoEmpresaCRM contacto = new ResponseContactoEmpresaCRM();
|
||||||
|
|
||||||
|
Boolean HuboError = false;
|
||||||
String NombreEmpresa = TxtNombreEmpresa.Text;
|
String NombreEmpresa = TxtNombreEmpresa.Text;
|
||||||
String RFC = TxtRFC.Text;
|
String RFC = TxtRFC.Text;
|
||||||
String Correo = TxtCorreoEmpresaCRM.Text.Trim();
|
String Correo = TxtCorreoEmpresaCRM.Text.Trim();
|
||||||
@@ -291,7 +300,24 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
{
|
{
|
||||||
string Mensaje = "";
|
string Mensaje = "";
|
||||||
//DATOS GENERALES
|
//DATOS GENERALES
|
||||||
CveEmpresaCRM = ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CveEncuestaAplicada, CveVendedorActualizar, CveSubProyecto, Correo, DdlGiroClasificacion.SelectedValue.ToEntero());
|
cRMModel.Empresa = NombreEmpresa;
|
||||||
|
cRMModel.RFC = RFC;
|
||||||
|
cRMModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
cRMModel.CveEmpresa = UsuarioActual.CveEmpresa;
|
||||||
|
cRMModel.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
cRMModel.CveEncuestaAplicada = CveEncuestaAplicada;
|
||||||
|
cRMModel.CveVendedorAsignado = CveVendedorActualizar;
|
||||||
|
cRMModel.CveSubProyecto = CveSubProyecto;
|
||||||
|
cRMModel.Correo = Correo;
|
||||||
|
cRMModel.CveGiroClasificacion = DdlGiroClasificacion.SelectedValue.ToEntero();
|
||||||
|
cRMModel.CveCliente = -1;
|
||||||
|
CveEmpresaCRM = cRMService.EmpresasCRMAdd(cRMModel).ToEntero();
|
||||||
|
if (CveEmpresaCRM <= 0 )
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CveEmpresaCRM = ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CveEncuestaAplicada, CveVendedorActualizar, CveSubProyecto, Correo, DdlGiroClasificacion.SelectedValue.ToEntero());
|
||||||
|
|
||||||
if (CveEmpresaCRM > 0)
|
if (CveEmpresaCRM > 0)
|
||||||
{
|
{
|
||||||
@@ -310,12 +336,28 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
|
|
||||||
foreach (DataRow row in TempDTContactos.Rows)
|
foreach (DataRow row in TempDTContactos.Rows)
|
||||||
{
|
{
|
||||||
if (!ObjCRM.AddContactoEmpresa(row["Nombre"].ToString(), row["TelefonoOficina"].ToString(), row["Celular"].ToString(), row["Correo"].ToString(), CveEmpresaCRM, UsuarioActual.CveUsuario))
|
contacto.Nombre = row["Nombre"].ToString();
|
||||||
HuboError = true;
|
contacto.TelefonoOficina = row["TelefonoOficina"].ToString();
|
||||||
else
|
contacto.Celular = row["Celular"].ToString();
|
||||||
|
contacto.Correo = row["Correo"].ToString();
|
||||||
|
contacto.CveEmpresaCRM = CveEmpresaCRM;
|
||||||
|
contacto.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
bool Contactoagregado = cRMService.EmpresasCRMContactoAdd(contacto);
|
||||||
|
if (Contactoagregado)
|
||||||
|
{
|
||||||
Mensaje += row["Nombre"].ToString() + ((i == numContactos) ? "" : ", ");
|
Mensaje += row["Nombre"].ToString() + ((i == numContactos) ? "" : ", ");
|
||||||
|
i++;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (!ObjCRM.AddContactoEmpresa(row["Nombre"].ToString(), row["TelefonoOficina"].ToString(), row["Celular"].ToString(), row["Correo"].ToString(), CveEmpresaCRM, UsuarioActual.CveUsuario))
|
||||||
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,16 +380,34 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
CveEncuestaAplicada = GuardaDatosTecnicos(ObjDatosTecnicos, CveEncuestaAplicada);
|
CveEncuestaAplicada = GuardaDatosTecnicos(ObjDatosTecnicos, CveEncuestaAplicada);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CveEncuestaAplicada != 0) && ObjCRM.UpdateEmpresCRM(NombreEmpresa, RFC, CveMedioCaptacion, CveEmpresaCRM, CveVendedorActualizar, UsuarioActual.CveUsuario, CveSubProyecto: CveSubProyecto, Correo: Correo,CveGiroClasificacion:DdlGiroClasificacion.SelectedValue.ToEntero()))
|
if (CveEncuestaAplicada != 0)
|
||||||
{
|
{
|
||||||
if (!ObjBitacora.AddEventoBitacora(String.Format("Se actualizó la empresa {0} con RFC {1}", NombreEmpresa, RFC), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
cRMModel.Empresa = NombreEmpresa;
|
||||||
|
cRMModel.RFC = RFC;
|
||||||
|
cRMModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
cRMModel.CveEmpresaCRM = CveEmpresaCRM;
|
||||||
|
cRMModel.CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
cRMModel.CveEncuestaAplicada = CveEncuestaAplicada;
|
||||||
|
cRMModel.CveVendedorAsignado = CveVendedorActualizar;
|
||||||
|
cRMModel.CveSubProyecto = CveSubProyecto;
|
||||||
|
cRMModel.Correo = Correo;
|
||||||
|
cRMModel.CveGiroClasificacion = DdlGiroClasificacion.SelectedValue.ToEntero();
|
||||||
|
cRMModel.CveCliente = -1;
|
||||||
|
if (cRMService.EmpresasCRMUpdate(cRMModel))
|
||||||
|
{
|
||||||
|
if (!ObjBitacora.AddEventoBitacora(String.Format("Se actualizó la empresa {0} con RFC {1}", NombreEmpresa, RFC), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
string asunto = String.Format("Se actualizó la empresa {0}",NombreEmpresa);
|
||||||
|
string mensaje = String.Format("Se actualizó la empresa {0} con RFC {1} por el usuario {2}", NombreEmpresa, RFC,UsuarioActual.Nombre);
|
||||||
|
mandarCorreo(asunto, mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HuboError = true;
|
HuboError = true;
|
||||||
}else
|
|
||||||
{
|
|
||||||
string asunto = String.Format("Se actualizó la empresa {0}",NombreEmpresa);
|
|
||||||
string mensaje = String.Format("Se actualizó la empresa {0} con RFC {1} por el usuario {2}", NombreEmpresa, RFC,UsuarioActual.Nombre);
|
|
||||||
mandarCorreo(asunto, mensaje);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,7 +420,10 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
else
|
else
|
||||||
Alert(String.Format("La Empresa <b>{0}</b> fue actualizada correctamente.", NombreEmpresa), ModExtensiones.TipoMensaje.MsgInformacion);
|
Alert(String.Format("La Empresa <b>{0}</b> fue actualizada correctamente.", NombreEmpresa), ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
}
|
}
|
||||||
else { ObjCRM.RollBack(); }
|
else {
|
||||||
|
Alert("Ocurrio un error la guardar la informacion de la empresa", ModExtensiones.TipoMensaje.MsgError);
|
||||||
|
ObjCRM.RollBack();
|
||||||
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
ObjCRM.Dispose();
|
||||||
ObjBitacora.Dispose();
|
ObjBitacora.Dispose();
|
||||||
@@ -568,29 +631,39 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
|
|
||||||
protected void CargaTipoProceso()
|
protected void CargaTipoProceso()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestTipoProceso tipoProceso = new RequestTipoProceso(UsuarioActual.CveEmpresa);
|
||||||
|
var ObjTipoProceso = cRMService.GetTipoProcesoCRM(tipoProceso);
|
||||||
|
|
||||||
|
if (ObjTipoProceso.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlTipoProceso2.DataSource = ObjCRM.DtResultados;
|
DdlTipoProceso2.DataSource = ObjTipoProceso.Result;
|
||||||
DdlTipoProceso2.Items.Insert(0, new ListItem("Seleccione","-1"));
|
DdlTipoProceso2.Items.Insert(0, new ListItem("Seleccione","-1"));
|
||||||
}
|
}
|
||||||
DdlTipoProceso2.DataBind();
|
DdlTipoProceso2.DataBind();
|
||||||
ObjCRM.Dispose();
|
//ObjCRM.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CargaMetodosCaptacion()
|
protected void CargaMetodosCaptacion()
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, -1))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestMedioCaptacion MedioCaptacion = new RequestMedioCaptacion(UsuarioActual.CveEmpresa);
|
||||||
|
var ObjMedioCaptacion = cRMService.GetMedioCaptacionCRM(MedioCaptacion);
|
||||||
|
|
||||||
|
if (ObjMedioCaptacion.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso2.SelectedValue));
|
DataTable tempMedio;
|
||||||
|
tempMedio = ObjMedioCaptacion.Result.ToDataTable();
|
||||||
|
DdlMedioCaptacion.DataSource = tempMedio.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso2.SelectedValue));
|
||||||
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
DdlMedioCaptacionAcercamiento.Items.Clear();
|
DdlMedioCaptacionAcercamiento.Items.Clear();
|
||||||
DdlMedioCaptacionAcercamiento.DataSource = ObjCRM.DtResultados;
|
DdlMedioCaptacionAcercamiento.DataSource = tempMedio;
|
||||||
DtMedioCaptacion = ObjCRM.DtResultados;
|
DtMedioCaptacion = tempMedio;
|
||||||
DdlMedioCaptacionAcercamiento.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlMedioCaptacionAcercamiento.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
}
|
}
|
||||||
ObjCRM.Dispose();
|
//ObjCRM.Dispose();
|
||||||
DdlMedioCaptacion.DataBind();
|
DdlMedioCaptacion.DataBind();
|
||||||
DdlMedioCaptacionAcercamiento.DataBind();
|
DdlMedioCaptacionAcercamiento.DataBind();
|
||||||
}
|
}
|
||||||
@@ -628,26 +701,25 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
|
|
||||||
if (CveEmpresaCRM > 0)
|
if (CveEmpresaCRM > 0)
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
//ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
if (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) && ObjCRM.DtResultados.Rows.Count > 0)
|
RequestEmpresasCRM parametros = new RequestEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM);
|
||||||
|
var objServicio = cRMService.GetEmpresasCRM(parametros);
|
||||||
|
if (objServicio.Result.Count > 0)
|
||||||
{
|
{
|
||||||
EsEditar = true;
|
EsEditar = true;
|
||||||
|
LblEncabezadoEmpresa.Text = String.Format("Consulta de la Empresa: {0}", objServicio.Result[0].Empresa);
|
||||||
LblEncabezadoEmpresa.Text = String.Format("Consulta de la Empresa: {0}", ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToUpper());
|
TxtNombreEmpresa.Text = objServicio.Result[0].Empresa;
|
||||||
|
TxtRFC.Text = objServicio.Result[0].RFC;
|
||||||
TxtNombreEmpresa.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa");
|
DdlTipoProceso2.SelectedValueExist(objServicio.Result[0].CveTipoProceso);
|
||||||
TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC");
|
|
||||||
DdlTipoProceso2.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso"));
|
|
||||||
CargaMetodosCaptacion();
|
CargaMetodosCaptacion();
|
||||||
TxtCorreoEmpresaCRM.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo");
|
TxtCorreoEmpresaCRM.Text = objServicio.Result[0].Correo;
|
||||||
DdlMedioCaptacion.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveMedioCaptacion"));
|
DdlMedioCaptacion.SelectedValueExist(objServicio.Result[0].CveMedioCaptacion);
|
||||||
|
CveEncuestaAplicada = objServicio.Result[0].CveEncuestaAplicada > 0 ? objServicio.Result[0].CveEncuestaAplicada.ToEntero() : -1;
|
||||||
CveEncuestaAplicada = ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaAplicada") != "" ? ObjCRM.DtResultados.FiltroPrimeroValor("CveEncuestaAplicada").ToEntero() : -1;
|
CveVendedor = objServicio.Result[0].CveVendedorAsignado.ToEntero();
|
||||||
CveVendedor = ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedorAsignado").ToEntero();
|
CveSubProyecto = objServicio.Result[0].CveSubProyecto.ToEntero();
|
||||||
CveSubProyecto = ObjCRM.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero();
|
CveCliente = objServicio.Result[0].CveCliente.ToEntero();
|
||||||
CveCliente = ObjCRM.DtResultados.FiltroPrimeroValor("CveCliente").ToEntero();
|
CveGiroClasificacion = objServicio.Result[0].CveGiroClasificacion > 0 ? objServicio.Result[0].CveGiroClasificacion.ToEntero() : -1;
|
||||||
CveGiroClasificacion = ObjCRM.DtResultados.FiltroPrimeroValor("CveGiroClasificacion") != "" ? ObjCRM.DtResultados.FiltroPrimeroValor("CveGiroClasificacion").ToEntero() : -1;
|
|
||||||
|
|
||||||
if (!(CveCliente > 0))
|
if (!(CveCliente > 0))
|
||||||
{
|
{
|
||||||
@@ -655,11 +727,11 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
HplCrearCliente.NavigateUrl = String.Format("/Ventas/Clientes.aspx?CveEmpresaCRM={0}", CveEmpresaCRM);
|
HplCrearCliente.NavigateUrl = String.Format("/Ventas/Clientes.aspx?CveEmpresaCRM={0}", CveEmpresaCRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
CargaContactos(ObjCRM);
|
CargaContactos();
|
||||||
ActivaSeccionAcercamientos();
|
ActivaSeccionAcercamientos();
|
||||||
CargaAcercamientos(ObjCRM);
|
CargaAcercamientos();
|
||||||
|
|
||||||
InicializaAcercamientos(ObjCRM);
|
InicializaAcercamientos();
|
||||||
|
|
||||||
CargaCotizaciones();
|
CargaCotizaciones();
|
||||||
|
|
||||||
@@ -676,7 +748,6 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
CveGiroClasificacion = -1;
|
CveGiroClasificacion = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
|
||||||
UpDatos.Update();
|
UpDatos.Update();
|
||||||
|
|
||||||
BtnGuardarEmpresa.Text = "Actualizar";
|
BtnGuardarEmpresa.Text = "Actualizar";
|
||||||
@@ -738,20 +809,40 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
Boolean HuboError = true;
|
Boolean HuboError = true;
|
||||||
|
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestContactoEmpresaCRM ContactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM);
|
||||||
|
RequestEmpresasCRM EmpresasCRM = new RequestEmpresasCRM(-1, CveEmpresaCRM);
|
||||||
|
RequestAcercamiento aceramientoGet = new RequestAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM);
|
||||||
|
var objAcercamiento = cRMService.GetAceracamientoCRM(aceramientoGet);
|
||||||
|
|
||||||
ClsEncuestas objDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
ClsEncuestas objDatosTecnicos = new ClsEncuestas(ObjCRM.IniciaTransacSQL());
|
||||||
|
if (objAcercamiento.Result.Count == 0)
|
||||||
if (ObjCRM.RemoveContactoEmpresa(-1, CveEmpresaCRM))
|
|
||||||
{
|
{
|
||||||
if (ObjCRM.RemoveEmpresaCRM(CveEmpresaCRM))
|
|
||||||
{
|
|
||||||
HuboError = false;
|
|
||||||
|
|
||||||
if (CveEncuestaAplicada > 0 && !objDatosTecnicos.RemoveEncuestaAplicada(CveEncuestaAplicada, UsuarioActual.CveEmpresa))
|
if (cRMService.EmpresasCRMContactoDelete(ContactoEmpresaCRM))
|
||||||
|
{
|
||||||
|
if (cRMService.EmpresasCRMDelete(EmpresasCRM))
|
||||||
|
{
|
||||||
|
HuboError = false;
|
||||||
|
if (CveEncuestaAplicada > 0 && !objDatosTecnicos.RemoveEncuestaAplicada(CveEncuestaAplicada, UsuarioActual.CveEmpresa))
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HuboError = true;
|
HuboError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert("No se puede eliminar la empresa porque el prospecto cuenta con cotizaciones/facturaciones previa", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HuboError)
|
if (!HuboError)
|
||||||
@@ -759,7 +850,11 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
ObjCRM.Commit();
|
ObjCRM.Commit();
|
||||||
Alert("La Empresa ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion, "document.location.href=\"/CRM/CatEmpresasCRM.aspx\"");
|
Alert("La Empresa ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion, "document.location.href=\"/CRM/CatEmpresasCRM.aspx\"");
|
||||||
}
|
}
|
||||||
else { ObjCRM.RollBack(); }
|
else {
|
||||||
|
ObjCRM.RollBack();
|
||||||
|
Alert("Ocurrio un error al intentar eliminar la empresa.", ModExtensiones.TipoMensaje.MsgError);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ObjCRM.Dispose();
|
ObjCRM.Dispose();
|
||||||
objDatosTecnicos.Dispose();
|
objDatosTecnicos.Dispose();
|
||||||
@@ -810,13 +905,15 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
UpContactos.Update();
|
UpContactos.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CargaContactos(ClsCRM objCRM)
|
protected void CargaContactos()
|
||||||
{
|
{
|
||||||
TempDTContactos = null;
|
TempDTContactos = null;
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
if (objCRM.GetContactoEmpresa(CveEmpresaCRM))
|
RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa, -1);
|
||||||
|
var objCRM = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM);
|
||||||
|
if (objCRM.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DTContactos = objCRM.DtResultados;
|
DTContactos = objCRM.Result.ToDataTable();
|
||||||
GVContactos.DataSource = DTContactos;
|
GVContactos.DataSource = DTContactos;
|
||||||
GVContactos.DataBind();
|
GVContactos.DataBind();
|
||||||
|
|
||||||
@@ -897,13 +994,23 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
ResponseContactoEmpresaCRM contacto = new ResponseContactoEmpresaCRM();
|
||||||
|
|
||||||
Boolean HuboError = true;
|
Boolean HuboError = true;
|
||||||
|
|
||||||
int CveUsuarioIng = UsuarioActual.CveUsuario;
|
int CveUsuarioIng = UsuarioActual.CveUsuario;
|
||||||
|
|
||||||
if (!EsEditarContacto)
|
if (!EsEditarContacto)
|
||||||
{
|
{
|
||||||
if (ObjCRM.AddContactoEmpresa(NombreContacto, TelefonoOficina, Celular, Correo, CveEmpresaCRM, CveUsuarioIng))
|
contacto.Nombre = NombreContacto;
|
||||||
|
contacto.TelefonoOficina = TelefonoOficina;
|
||||||
|
contacto.Celular = Celular;
|
||||||
|
contacto.Correo = Correo;
|
||||||
|
contacto.CveEmpresaCRM = CveEmpresaCRM;
|
||||||
|
contacto.CveUsuarioIng = CveUsuarioIng;
|
||||||
|
|
||||||
|
if (cRMService.EmpresasCRMContactoAdd(contacto))
|
||||||
{
|
{
|
||||||
TelefonoOficina = (TelefonoOficina != "-1" ? String.Format(", Teléfono de Oficina: {0:(###) ###-####}", Convert.ToInt64(TelefonoOficina)) : "");
|
TelefonoOficina = (TelefonoOficina != "-1" ? String.Format(", Teléfono de Oficina: {0:(###) ###-####}", Convert.ToInt64(TelefonoOficina)) : "");
|
||||||
Celular = (Celular != "-1" ? String.Format(", Celular: {0:(###) ###-####}", Convert.ToInt64(Celular)) : "");
|
Celular = (Celular != "-1" ? String.Format(", Celular: {0:(###) ###-####}", Convert.ToInt64(Celular)) : "");
|
||||||
@@ -918,10 +1025,23 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
Alert("El Contacto fue creado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion);
|
Alert("El Contacto fue creado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HuboError = true;
|
||||||
|
Alert(String.Format("Ocurrio un error al crear contacto: <b>{0}</b>. ", NombreContacto), ModExtensiones.TipoMensaje.MsgError);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ObjCRM.UpdateContactoEmpresa(NombreContacto, TelefonoOficina, Celular, Correo, CveContactoEditado, UsuarioActual.CveUsuario))
|
contacto.Nombre = NombreContacto;
|
||||||
|
contacto.TelefonoOficina = TelefonoOficina;
|
||||||
|
contacto.Celular = Celular;
|
||||||
|
contacto.Correo = Correo;
|
||||||
|
contacto.CveContacto = CveContactoEditado;
|
||||||
|
contacto.CveUsuarioIng = CveUsuarioIng;
|
||||||
|
|
||||||
|
if (cRMService.EmpresasCRMContactoUpdate(contacto))
|
||||||
{
|
{
|
||||||
//if (ObjBitacora.AddEventoBitacora(String.Format("Se actualizó el contacto {0}", NombreContacto), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
//if (ObjBitacora.AddEventoBitacora(String.Format("Se actualizó el contacto {0}", NombreContacto), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
||||||
//{
|
//{
|
||||||
@@ -929,9 +1049,14 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
Alert(String.Format("Se actualizó el contacto {0}.", NombreContacto), ModExtensiones.TipoMensaje.MsgInformacion);
|
Alert(String.Format("Se actualizó el contacto {0}.", NombreContacto), ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert(String.Format("Ocurrio un error al actualizar contacto: {0}.", NombreContacto), ModExtensiones.TipoMensaje.MsgError);
|
||||||
|
HuboError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CargaContactos(ObjCRM);
|
CargaContactos();
|
||||||
|
|
||||||
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
||||||
|
|
||||||
@@ -984,10 +1109,12 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
|
||||||
if (ObjCRM.RemoveContactoEmpresa(CveContactoEditado))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestContactoEmpresaCRM contacto = new RequestContactoEmpresaCRM(-1, -1, CveContactoEditado);
|
||||||
|
if (cRMService.EmpresasCRMContactoDelete(contacto))
|
||||||
{
|
{
|
||||||
HuboError = false;
|
HuboError = false;
|
||||||
CargaContactos(ObjCRM);
|
CargaContactos();
|
||||||
Alert("El Contacto ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
|
Alert("El Contacto ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
|
|
||||||
if (ObjBitacora.AddEventoBitacora(String.Format("Se eliminó el contacto {0}", NombreContacto), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
if (ObjBitacora.AddEventoBitacora(String.Format("Se eliminó el contacto {0}", NombreContacto), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
||||||
@@ -1000,6 +1127,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Alert(String.Format("Ocurrio un error al eliminar el contacto: {0}.", NombreContacto), ModExtensiones.TipoMensaje.MsgInformacion);
|
||||||
ObjCRM.RollBack();
|
ObjCRM.RollBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,7 +1196,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
if (ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim(), string.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM: CveEmpresaCRM))
|
||||||
{
|
{
|
||||||
if (filemove != "")
|
if (filemove != "")
|
||||||
filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:false);
|
filemove.FilesMove(string.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString()), string.Format(@"Empresas\{0}\OI", UsuarioActual.CveEmpresa));
|
||||||
|
|
||||||
|
|
||||||
TxtEventoDescripcion.Text = "";
|
TxtEventoDescripcion.Text = "";
|
||||||
@@ -1332,33 +1460,34 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
RVFechaApertura.MaximumValue = DateTime.Now.ToShortDateString();
|
RVFechaApertura.MaximumValue = DateTime.Now.ToShortDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void InicializaAcercamientos(ClsCRM ObjCRM)
|
protected void InicializaAcercamientos()
|
||||||
{
|
{
|
||||||
DdlTipoProceso.Items.Clear();
|
DdlTipoProceso.Items.Clear();
|
||||||
DdlProbabilidadAcercamiento.Items.Clear();
|
DdlProbabilidadAcercamiento.Items.Clear();
|
||||||
DdlVendedor.Items.Clear();
|
DdlVendedor.Items.Clear();
|
||||||
|
|
||||||
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa, 1))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestProbalidadAcercamiento ProbalidadAcercamiento = new RequestProbalidadAcercamiento(UsuarioActual.CveEmpresa, 1);
|
||||||
|
var ObjProbalidadAcercamiento = cRMService.GetProbabilidadAceracamientoCRM(ProbalidadAcercamiento);
|
||||||
|
|
||||||
|
RequestTipoProceso tipoProceso = new RequestTipoProceso(UsuarioActual.CveEmpresa, 1);
|
||||||
|
var ObjTipoProceso = cRMService.GetTipoProcesoCRM(tipoProceso);
|
||||||
|
|
||||||
|
if (ObjTipoProceso.Result.Count > 0)
|
||||||
{
|
{
|
||||||
DdlTipoProceso.DataSource = ObjCRM.DtResultados;
|
|
||||||
|
|
||||||
if (ObjCRM.DtResultados.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
DdlTipoProceso.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
||||||
|
|
||||||
DdlMedioCaptacionAcercamiento.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DdlTipoProceso.DataSource = ObjTipoProceso.Result;
|
||||||
|
DdlTipoProceso.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
|
DdlMedioCaptacionAcercamiento.Enabled = false;
|
||||||
DdlTipoProceso.DataBind();
|
DdlTipoProceso.DataBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjCRM.GetProbabilidadAcercamiento(UsuarioActual.CveEmpresa, 1))
|
if (ObjProbalidadAcercamiento.Result.Count > 0)
|
||||||
{
|
{
|
||||||
//DdlProbabilidadAcercamiento.DataSource = ObjCRM.DtResultados;
|
//DdlProbabilidadAcercamiento.DataSource = ObjCRM.DtResultados;
|
||||||
//DdlProbabilidadAcercamiento.DataBind();
|
//DdlProbabilidadAcercamiento.DataBind();
|
||||||
DdlProbabilidadAcercamiento.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
DdlProbabilidadAcercamiento.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
||||||
|
DtProbabilidadAcercamiento = ObjProbalidadAcercamiento.Result.ToDataTable();
|
||||||
DtProbabilidadAcercamiento = ObjCRM.DtResultados;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
|
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
|
||||||
@@ -1388,11 +1517,14 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void CargaAcercamientos(ClsCRM objCRM)
|
protected void CargaAcercamientos()
|
||||||
{
|
{
|
||||||
if (objCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM))
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestAcercamiento aceramientoGet = new RequestAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM:CveEmpresaCRM);
|
||||||
|
var objAcercamiento= cRMService.GetAceracamientoCRM(aceramientoGet);
|
||||||
|
if (objAcercamiento.IsSuccess)
|
||||||
{
|
{
|
||||||
GVAcercamientos.DataSource = objCRM.DtResultados;
|
GVAcercamientos.DataSource = objAcercamiento.Result;
|
||||||
GVAcercamientos.DataBind();
|
GVAcercamientos.DataBind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1405,10 +1537,8 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
|
||||||
CargaMetodosCaptacion();
|
CargaMetodosCaptacion();
|
||||||
InicializaAcercamientos(ObjCRM);
|
InicializaAcercamientos();
|
||||||
ObjCRM.Dispose();
|
|
||||||
limpiarCamposModalAcercamiento();
|
limpiarCamposModalAcercamiento();
|
||||||
this.RegistraScript("$('#DivModalAltaAcercamiento').modal();");
|
this.RegistraScript("$('#DivModalAltaAcercamiento').modal();");
|
||||||
UpAltaAcercamiento.Update();
|
UpAltaAcercamiento.Update();
|
||||||
@@ -1421,17 +1551,24 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
{
|
{
|
||||||
ClsCRM ObjCRM = new ClsCRM();
|
ClsCRM ObjCRM = new ClsCRM();
|
||||||
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
ClsOIEventos ObjBitacora = new ClsOIEventos(ObjCRM.IniciaTransacSQL());
|
||||||
|
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
AcercaminetoModel AcercamientoModel = new AcercaminetoModel();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Boolean HuboError = true;
|
Boolean HuboError = true;
|
||||||
|
|
||||||
String NombreAcercamiento = TxtAcercamiento.Text;
|
String NombreAcercamiento = TxtAcercamiento.Text;
|
||||||
String Descripcion = TxtDescripcionAcercamiento.Text == "" ? "-1" : TxtDescripcionAcercamiento.Text;
|
String Descripcion = TxtDescripcionAcercamiento.Text == "" ? "-1" : TxtDescripcionAcercamiento.Text;
|
||||||
|
|
||||||
int CveTipoProceso = DdlTipoProceso.SelectedValue.ToEntero();
|
int CveTipoProceso = DdlTipoProceso.SelectedValue.ToEntero();
|
||||||
|
RequestEtapaProceso EtapaProceso = new RequestEtapaProceso(UsuarioActual.CveEmpresa, CveTipoProceso: CveTipoProceso);
|
||||||
|
var ObjEtapaProceso = cRMService.GetEtapaProcesoCRM(EtapaProceso);
|
||||||
|
DataTable tempDT = null;
|
||||||
|
|
||||||
ObjCRM.GetEtapaProceso(UsuarioActual.CveEmpresa, CveTipoProceso);
|
if (ObjEtapaProceso.Result.Count > 0)
|
||||||
int CveEtapaProcesoActual = ObjCRM.DtResultados.FiltroPrimeroValor("CveEtapaProceso").ToEntero();
|
{
|
||||||
|
tempDT = ObjEtapaProceso.Result.ToDataTable();
|
||||||
|
}
|
||||||
|
int CveEtapaProcesoActual = tempDT.FiltroPrimeroValor("CveEtapaProceso").ToEntero();
|
||||||
int CveContactoPrincipal = DdlContactoPrincipal.SelectedValue.ToEntero();
|
int CveContactoPrincipal = DdlContactoPrincipal.SelectedValue.ToEntero();
|
||||||
int CveVendedor = DdlVendedor.SelectedValue.ToEntero();
|
int CveVendedor = DdlVendedor.SelectedValue.ToEntero();
|
||||||
int CveMedioCaptacion = DdlMedioCaptacionAcercamiento.SelectedValue.ToEntero();
|
int CveMedioCaptacion = DdlMedioCaptacionAcercamiento.SelectedValue.ToEntero();
|
||||||
@@ -1450,11 +1587,30 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
|
|
||||||
int CveAcercamiento = -1;
|
int CveAcercamiento = -1;
|
||||||
|
|
||||||
if (ObjCRM.DtResultados.Rows.Count > 0)
|
if (tempDT.Rows.Count > 0)
|
||||||
{
|
{
|
||||||
CveAcercamiento = ObjCRM.AddAcercamiento(CveEmpresaCRM, CveContactoPrincipal, CveTipoProceso, CveEtapaProcesoActual, CveVendedor, CveMedioCaptacion, CveRechazoMotivo, CveProbabilidadAcercamiento,
|
AcercamientoModel.CveEmpresaCRM = CveEmpresaCRM;
|
||||||
FechaApertura, NombreAcercamiento, Descripcion, Importe, Comision, Prioridad, UsuarioActual.CveEmpresa, CveUsuarioIng, CvePS:DdlPS.SelectedValue.ToEntero());
|
AcercamientoModel.CveContactoPrincipal = CveContactoPrincipal;
|
||||||
}else
|
AcercamientoModel.CveTipoProceso = CveTipoProceso;
|
||||||
|
AcercamientoModel.CveEtapaProcesoActual = CveEtapaProcesoActual;
|
||||||
|
AcercamientoModel.CveVendedor = CveVendedor;
|
||||||
|
AcercamientoModel.CveMedioCaptacion = CveMedioCaptacion;
|
||||||
|
AcercamientoModel.CveRechazoMotivo = CveRechazoMotivo;
|
||||||
|
AcercamientoModel.CveProbabilidadAcercamiento = CveProbabilidadAcercamiento;
|
||||||
|
AcercamientoModel.FechaApertura = FechaApertura;
|
||||||
|
AcercamientoModel.FechaCierre = (DateTime)System.Data.SqlTypes.SqlDateTime.Null;
|
||||||
|
AcercamientoModel.NombreAcercamiento = NombreAcercamiento;
|
||||||
|
AcercamientoModel.Descripcion = Descripcion;
|
||||||
|
AcercamientoModel.Importe = Importe;
|
||||||
|
AcercamientoModel.Comision = Comision;
|
||||||
|
AcercamientoModel.Prioridad = Prioridad;
|
||||||
|
AcercamientoModel.CveEmpresa = UsuarioActual.CveEmpresa;
|
||||||
|
AcercamientoModel.CveUsuarioIng = CveUsuarioIng;
|
||||||
|
AcercamientoModel.CvePS = DdlPS.SelectedValue.ToEntero();
|
||||||
|
|
||||||
|
CveAcercamiento = cRMService.AcercamientoAdd(AcercamientoModel).ToEntero();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Alert("No tiene 'Etapa Proceso' con el 'Proceso' seleccionado al agregar el Acercamiento",ModExtensiones.TipoMensaje.MsgAdvertencia);
|
Alert("No tiene 'Etapa Proceso' con el 'Proceso' seleccionado al agregar el Acercamiento",ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||||
}
|
}
|
||||||
@@ -1469,9 +1625,14 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
HuboError = false;
|
HuboError = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert("Ocurrio un error al agregar el Acercamiento", ModExtensiones.TipoMensaje.MsgError);
|
||||||
|
HuboError = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CargaAcercamientos(ObjCRM);
|
CargaAcercamientos();
|
||||||
|
|
||||||
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
||||||
|
|
||||||
@@ -1515,26 +1676,19 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
LnkAgregarAcercamiento.Visible = false;
|
LnkAgregarAcercamiento.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((UsuarioActual.CveVendedor != CveVendedor))
|
||||||
if (!UsuarioActual.TienePermisoProceso(330))
|
|
||||||
{
|
{
|
||||||
if ((UsuarioActual.CveVendedor != CveVendedor))
|
if(UsuarioActual.CveUsuario != 100)
|
||||||
{
|
{
|
||||||
BtnGuardarEmpresa.Visible = false;
|
BtnGuardarEmpresa.Visible = false;
|
||||||
BtnEliminarEmpresa.Visible = false;
|
BtnEliminarEmpresa.Visible = false;
|
||||||
BtnAgregarContacto.Visible = false;
|
BtnAgregarContacto.Visible = false;
|
||||||
//LnkAgregarAcercamiento.Visible = false;
|
//LnkAgregarAcercamiento.Visible = false;
|
||||||
DivAccionesBitacora.Visible = false;
|
DivAccionesBitacora.Visible = false;
|
||||||
GVContactos.Columns[4].Visible = false;
|
GVContactos.Columns[4].Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1543,10 +1697,18 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
|||||||
protected void CargaCotizaciones()
|
protected void CargaCotizaciones()
|
||||||
{
|
{
|
||||||
ClsVentas ObjVentas = new ClsVentas();
|
ClsVentas ObjVentas = new ClsVentas();
|
||||||
if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "Cot", "-1", -1, "-1", -1, -1, -1, -1, "-1", "-1", "-1", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta: UsuarioActual.CveUsuario))
|
IVentaService ventaService = new VentaService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||||
|
RequestVentas requestVentas = new RequestVentas(UsuarioActual.CveEmpresa, TipoDocto:"Cot", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta:UsuarioActual.CveUsuario);
|
||||||
|
var objVentas = ventaService.GetVentas(requestVentas);
|
||||||
|
if (objVentas.IsSuccess)
|
||||||
{
|
{
|
||||||
GvCotizacion.DataSource = ObjVentas.DtResultados;
|
GvCotizacion.DataSource = objVentas.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "Cot", "-1", -1, "-1", -1, -1, -1, -1, "-1", "-1", "-1", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta: UsuarioActual.CveUsuario))
|
||||||
|
//{
|
||||||
|
// GvCotizacion.DataSource = ObjVentas.DtResultados;
|
||||||
|
//}
|
||||||
ObjVentas.Dispose();
|
ObjVentas.Dispose();
|
||||||
GvCotizacion.DataBind();
|
GvCotizacion.DataBind();
|
||||||
UpCotizacion.Update();
|
UpCotizacion.Update();
|
||||||
|
|||||||
2083
CRM/RegPrePolizaS.aspx.vb
Normal file
2083
CRM/RegPrePolizaS.aspx.vb
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user