Files
SIG/CRM/RepAcercamientos.aspx.cs
2020-04-16 11:19:34 -07:00

89 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
public partial class CRM_RepAcercamientos : ClsPaginas
{
#region "PROPIEDADES"
private int CveVendedor
{
get
{
return ViewState["CveVendedor"].ToString().ToEntero();
}
set
{
ViewState["CveVendedor"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InicializaDatos();
CargaDatos();
}
}
#region "CARGA DATOS"
protected void BtnConsultar_Click(object sender, EventArgs e)
{
CargaDatos();
}
protected void CargaDatos()
{
CveVendedor = DdlVendedor.SelectedValue.ToEntero();
if (CveVendedor > 0)
{
string FechaInicio = TxtFechaInicio.Text == "" ? "-1" : TxtFechaInicio.Text;
string FechaFin = TxtFechaFin.Text == "" ? "-1" : TxtFechaFin.Text;
ClsCRM ObjCRM = new ClsCRM();
if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveVendedor: CveVendedor, FechaInicio: FechaInicio, FechaFin: FechaFin))
{
GVDatos.DataSource = ObjCRM.DtResultados;
GVDatos.DataBind();
}
ObjCRM.Dispose();
UPDatos.Update();
}else
{
Alert("El Campo Vendedor es requerido",ModExtensiones.TipoMensaje.MsgError);
}
}
protected void GVDatos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataKey("CveAcercamiento").ToEntero() > 0)
e.Row.FCHyperLink("HplNombreAcercamiento").NavigateUrl = String.Format("/CRM/Acercamiento.aspx?CveAcercamiento={0}", e.Row.DataKey("CveAcercamiento"));
}
}
protected void InicializaDatos()
{
CveVendedor = UsuarioActual.CveVendedor;
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
DdlVendedor.Items.Insert(0, new ListItem("Todos ", "-1"));
DdlVendedor.DataBind();
DdlVendedor.SelectedValueExist(CveVendedor);
//CALCULAMOS EL INTERVALO DE LA SEMANA ACTUAL
TxtFechaInicio.Text = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek) + 1).ToShortDateString();
//TxtFechaFin.Text = DateTime.Now.AddDays((7 - (int)DateTime.Now.DayOfWeek)).ToShortDateString();
}
#endregion
}