CRM Mejoras
This commit is contained in:
@@ -893,6 +893,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
|
||||
protected void EliminarEmpresa()
|
||||
{
|
||||
string ErrorEliminacionEmpresa = "";
|
||||
Boolean HuboError = true;
|
||||
|
||||
ClsCRM ObjCRM = new ClsCRM();
|
||||
@@ -916,12 +917,19 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
var responseModelRemoveEncuestaAplicada = encuestaService.RemoveEncuestaAplicada(new RequestEncuestaAplicadaRemove() { CveEmpresa = UsuarioActual.CveEmpresa, CveEncuestaAplicada = CveEncuestaAplicada });
|
||||
if (CveEncuestaAplicada > 0 && !responseModelRemoveEncuestaAplicada.IsSuccess)
|
||||
{
|
||||
HuboError = true;
|
||||
HuboError = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HuboError = true;
|
||||
|
||||
|
||||
if (cRMService.Mensaje != null && cRMService.Mensaje != "")
|
||||
{
|
||||
ErrorEliminacionEmpresa = cRMService.Mensaje;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -943,7 +951,18 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
else
|
||||
{
|
||||
ObjCRM.RollBack();
|
||||
Alert("Ocurrio un error al intentar eliminar la empresa.", ModExtensiones.TipoMensaje.MsgError);
|
||||
|
||||
if(ErrorEliminacionEmpresa.Trim().Length > 0 && ErrorEliminacionEmpresa.Contains("547;"))
|
||||
{
|
||||
Alert("No se puede eliminar la empresa debido a que tiene registros realcionados.", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Ocurrio un error al intentar eliminar la empresa.", ModExtensiones.TipoMensaje.MsgError);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1003,6 +1022,8 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
TempDTContactos = null;
|
||||
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||
RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa, -1);
|
||||
|
||||
|
||||
var objCRM = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM);
|
||||
if (objCRM.Result.Count > 0)
|
||||
{
|
||||
@@ -1039,9 +1060,11 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
}
|
||||
TxtNombreContacto.Text = "";
|
||||
TxtTelefonoOficina.Text = "";
|
||||
TxtTelExt.Text = "";
|
||||
TxtCelular.Text = "";
|
||||
TxtCorreo.Text = "";
|
||||
DdlTipocontacto.SelectedValueExist(-1);
|
||||
DdlContactoSuperior.SelectedValueExist(-1);
|
||||
}
|
||||
|
||||
protected void BtnAgregarContacto_Click(object sender, EventArgs e)
|
||||
@@ -1051,26 +1074,29 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
UPModalContacto.Update();
|
||||
|
||||
CargaGridTipoContacto();
|
||||
CargaContactoSuperior(-1);
|
||||
|
||||
this.RegistraScript("$('#DivModalContacto').modal();");
|
||||
}
|
||||
|
||||
protected void LnkEditarContacto_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveContactoEditado = GvRow.DataKey("CveContacto").ToEntero();
|
||||
|
||||
CargaGridTipoContacto();
|
||||
CargaContactoSuperior(CveContactoEditado);
|
||||
|
||||
EsEditarContacto = true;
|
||||
limpiarCamposModalContato();
|
||||
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
|
||||
CveContactoEditado = GvRow.DataKey("CveContacto").ToEntero();
|
||||
limpiarCamposModalContato();
|
||||
|
||||
TxtNombreContacto.Text = GvRow.DataKey("Nombre").ToString();
|
||||
TxtTelefonoOficina.Text = GvRow.DataKey("TelefonoOficina").ToString();
|
||||
TxtTelExt.Text = GvRow.DataKey("TelExt").ToString();
|
||||
TxtCelular.Text = GvRow.DataKey("Celular").ToString();
|
||||
TxtCorreo.Text = GvRow.DataKey("Correo").ToString();
|
||||
DdlTipocontacto.SelectedValueExist( GvRow.DataKey("CveTipoContacto").ToString());
|
||||
DdlContactoSuperior.SelectedValueExist(GvRow.DataKey("CveContactoSuperior").ToString());
|
||||
|
||||
IndexDTContacto = GvRow.RowIndex;
|
||||
|
||||
@@ -1087,6 +1113,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
|
||||
String NombreContacto = TxtNombreContacto.Text;
|
||||
String TelefonoOficina = TxtTelefonoOficina.Text == "" ? "-1" : TxtTelefonoOficina.Text;
|
||||
String TelExt = TxtTelExt.Text == "" ? "-1" : TxtTelExt.Text;
|
||||
String Celular = TxtCelular.Text == "" ? "-1" : TxtCelular.Text;
|
||||
String Correo = TxtCorreo.Text == "" ? "-1" : TxtCorreo.Text;
|
||||
|
||||
@@ -1107,15 +1134,18 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
{
|
||||
contacto.Nombre = NombreContacto;
|
||||
contacto.TelefonoOficina = TelefonoOficina;
|
||||
contacto.TelExt = TelExt;
|
||||
contacto.Celular = Celular;
|
||||
contacto.Correo = Correo;
|
||||
contacto.CveEmpresaCRM = CveEmpresaCRM;
|
||||
contacto.CveUsuarioIng = CveUsuarioIng;
|
||||
contacto.CveTipoContacto = DdlTipocontacto.SelectedValue.ToEntero();
|
||||
contacto.CveContactoSuperior = DdlContactoSuperior.SelectedValue.ToEntero();
|
||||
|
||||
if (cRMService.EmpresasCRMContactoAdd(contacto))
|
||||
{
|
||||
TelefonoOficina = (TelefonoOficina != "-1" ? String.Format(", Teléfono de Oficina: {0:(###) ###-####}", Convert.ToInt64(TelefonoOficina)) : "");
|
||||
TelExt = (TelExt != "-1" ? String.Format(", Teléfono extensión: {0}", TelExt):"");
|
||||
Celular = (Celular != "-1" ? String.Format(", Celular: {0:(###) ###-####}", Convert.ToInt64(Celular)) : "");
|
||||
Correo = (Correo != "-1" ? String.Format(", Correo: {0}", Correo) : "");
|
||||
|
||||
@@ -1139,11 +1169,13 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
{
|
||||
contacto.Nombre = NombreContacto;
|
||||
contacto.TelefonoOficina = TelefonoOficina;
|
||||
contacto.TelExt = TelExt;
|
||||
contacto.Celular = Celular;
|
||||
contacto.Correo = Correo;
|
||||
contacto.CveContacto = CveContactoEditado;
|
||||
contacto.CveUsuarioIng = CveUsuarioIng;
|
||||
contacto.CveTipoContacto = DdlTipocontacto.SelectedValue.ToEntero();
|
||||
contacto.CveContactoSuperior = DdlContactoSuperior.SelectedValue.ToEntero();
|
||||
|
||||
if (cRMService.EmpresasCRMContactoUpdate(contacto))
|
||||
{
|
||||
@@ -1265,6 +1297,33 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
e.Row.FCLabel("lblCelular").Text = String.Format("{0:(###) ###-####}", Convert.ToInt64(e.Row.DataKey("Celular")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void LnkNombreContactoAgenda_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
//CveContacto,Nombre,TelefonoOficina,Celular,Correo,CveUsuarioIng,FechaIng,CveTipoContacto
|
||||
int CveContacto = GvRow.DataKey("CveContacto").ToEntero();
|
||||
string NombreContacto = GvRow.DataKey("Nombre");
|
||||
|
||||
TempDTContactos = null;
|
||||
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||
RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa, CveContacto);
|
||||
|
||||
|
||||
var objCRM = cRMService.GetContactosEmpresaAgendaCRM(contactoEmpresaCRM);
|
||||
|
||||
if (objCRM.Result.Count > 0)
|
||||
{
|
||||
GvContactoAgenda.DataSource = objCRM.Result.ToDataTable();
|
||||
GvContactoAgenda.DataBind();
|
||||
|
||||
UpModalContactoAgenda.Update();
|
||||
LblModalContactoAgendaTitulo.Text = $"Agenda: {NombreContacto}";
|
||||
RegistraScript("$('#DVModalContactoAgenda').modal('show');");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "BITACORA"
|
||||
@@ -1904,7 +1963,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
protected void LnkAgregartipoContacto_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
CargaGridTipoContacto();
|
||||
CargaGridTipoContacto();
|
||||
RegistraScript("$('#DivModalTipoContacto').modal('show');");
|
||||
}
|
||||
|
||||
@@ -1943,6 +2002,26 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
|
||||
cRMService = null;
|
||||
}
|
||||
|
||||
private void CargaContactoSuperior(int CveConcactoOmitir)
|
||||
{
|
||||
|
||||
DdlContactoSuperior.Items.Clear();
|
||||
ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
||||
RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa,-1);
|
||||
var objcontactoEmpresa = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM);
|
||||
|
||||
if (objcontactoEmpresa.Result.Count > 0)
|
||||
{
|
||||
DdlContactoSuperior.DataSource = objcontactoEmpresa.Result.ToDataTable().FiltraParametros((CveConcactoOmitir>0 ?$" CveContacto <> {CveConcactoOmitir} ": "" ));
|
||||
DdlContactoSuperior.DataBind();
|
||||
}
|
||||
DdlContactoSuperior.Items.Insert(0, new ListItem("Sin Asignar ", "-1"));
|
||||
|
||||
UPModalContacto.Update();
|
||||
|
||||
|
||||
}
|
||||
protected void btnAgregarTipoContacto_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool ErrorProceso = false;
|
||||
@@ -1962,7 +2041,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
CargaGridTipoContacto();
|
||||
CargaGridTipoContacto();
|
||||
LimpiaTipoContacto();
|
||||
}
|
||||
}
|
||||
@@ -2001,4 +2080,6 @@ public partial class CRM_EmpresaCRM : ClsPaginas
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user