Commit inicial Ventas Productivo
This commit is contained in:
109
CRM/CatEmpresasCRM.aspx.cs
Normal file
109
CRM/CatEmpresasCRM.aspx.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Data;
|
||||
|
||||
using Extensiones;
|
||||
|
||||
public partial class CRM_CatEmpresasCRM : ClsPaginas
|
||||
{
|
||||
#region "PROPIEDADES"
|
||||
private DataTable TmpDT
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DataTable)ViewState["TmpDT"];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["TmpDT"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargaMediosCaptacion();
|
||||
CargaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
#region "CARGA DATOS"
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
protected void CargaDatos()
|
||||
{
|
||||
ClsCRM ObjCRM = new ClsCRM();
|
||||
|
||||
if (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveMedioCaptacion: DdlMedioCaptacion.SelectedValue.ToEntero()) && ObjCRM.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
TmpDT = ObjCRM.DtResultados;
|
||||
GVDatos.DataSource = TmpDT;
|
||||
}
|
||||
ObjCRM.Dispose();
|
||||
GVDatos.DataBind();
|
||||
UPDatos.Update();
|
||||
}
|
||||
|
||||
protected void CargaMediosCaptacion()
|
||||
{
|
||||
ClsCRM ObjCRM = new ClsCRM();
|
||||
|
||||
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, 1))
|
||||
{
|
||||
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados;
|
||||
DdlMedioCaptacion.DataBind();
|
||||
DdlMedioCaptacion.Items.Insert(0, new ListItem("Todos ", "-1"));
|
||||
}
|
||||
ObjCRM.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "ACCIONES - GRIEDVIEW"
|
||||
protected void GVDatos_RowDeleting(object sender, GridViewDeleteEventArgs e)
|
||||
{
|
||||
int CveEmpresaCRM = GVDatos.Rows[e.RowIndex].DataKey("CveEmpresaCRM").ToEntero();
|
||||
Boolean HuboError = true;
|
||||
|
||||
ClsCRM ObjCRM = new ClsCRM();
|
||||
|
||||
ObjCRM.IniciaTransacSQL();
|
||||
|
||||
if (ObjCRM.RemoveContactoEmpresa(-1, CveEmpresaCRM))
|
||||
{
|
||||
if (ObjCRM.RemoveEmpresaCRM(CveEmpresaCRM))
|
||||
{
|
||||
HuboError = false;
|
||||
Alert("La Empresa ha sido eliminado.", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||
}
|
||||
}
|
||||
|
||||
if (!HuboError) { ObjCRM.Commit(); } else { ObjCRM.RollBack(); }
|
||||
|
||||
ObjCRM.Dispose();
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
protected void GVDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
e.Row.FCHyperLink("HplEmpresa").NavigateUrl = String.Format("/CRM/EmpresaCRM.aspx?CveEmpresaCRM={0}", e.Row.DataKey("CveEmpresaCRM")) ;
|
||||
|
||||
if (e.Row.DataKey("NoContactos").ToEntero() > 0)
|
||||
{
|
||||
e.Row.FCLabel("lblNoContactos").Text = String.Format("<b>{0}</b>", e.Row.DataKey("NoContactos"));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user