コード例 #1
0
        Vendedor CrearNuevoVendedor(VendedorDTO pVendedorDTO, Almacen pAlmacen,
                                    EstadoVendedor pEstadoVendedor,
                                    UsuarioSistema pUsuarioSistema,
                                    UsuarioSistema pUsuarioSistemaAcceso,
                                    VendedorDireccion pDireccionPrimero)
        {
            try
            {
                Vendedor nuevoVendedor = VendedorFactory.CrearVendedor(pVendedorDTO.NombresVendedor,
                                                                       pVendedorDTO.DocumentoIdentidad, pVendedorDTO.Telefono,
                                                                       pVendedorDTO.Sexo, pVendedorDTO.FechaInicio,
                                                                       pVendedorDTO.CodigoVendedor, pVendedorDTO.Clave,
                                                                       pVendedorDTO.FechaNacimiento, pAlmacen, pEstadoVendedor,
                                                                       pUsuarioSistema, pUsuarioSistemaAcceso, pDireccionPrimero);
                return(nuevoVendedor);
            }
            catch (Exception ex)
            {
                string detallesAsicionales = string.Empty;
                string cadenaExcepcion     = ex.Message;

                if (ex.InnerException != null)
                {
                    detallesAsicionales = " .Detalles Interno: " + ex.InnerException != null && ex.InnerException.InnerException != null ?
                                          ex.InnerException.InnerException.Message : "Ver Detalles.";
                }

                LogFactory.CrearLog().LogWarning(cadenaExcepcion + detallesAsicionales);
                throw;
            }
        }
コード例 #2
0
        internal static DadosExtraidos Executar(string nomeCaminhoArquivo)
        {
            var conteudoArquivo = File.ReadAllText(nomeCaminhoArquivo).Split(Environment.NewLine);
            var registro        = new DadosExtraidos();

            foreach (var linhaArquivo in conteudoArquivo)
            {
                var registrosLinha = linhaArquivo.Split(VariaveisDeAmbiente.DelimitadorRegistros);
                switch (registrosLinha[0])
                {
                case TipoRegistroEnum.DadosVendedor:
                    var factoryVendedor = new VendedorFactory(registrosLinha);
                    registro.Vendedores.Add(factoryVendedor.FactoryMethod());
                    break;

                case TipoRegistroEnum.DadosCliente:
                    var factoryCliente = new ClienteFactory(registrosLinha);
                    registro.Clientes.Add(factoryCliente.FactoryMethod());
                    break;

                case TipoRegistroEnum.DadosVenda:
                    var factoryVenda = new VendaFactory(registrosLinha);
                    registro.Vendas.Add(factoryVenda.FactoryMethod());
                    break;
                }
            }

            return(registro);
        }
コード例 #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string permiteReportes   = System.Configuration.ConfigurationSettings.AppSettings["Server"];
            string dirServerReportes = System.Configuration.ConfigurationSettings.AppSettings["DirServerReportes"];

            if (permiteReportes == "P")
            {
                // si no permite reportes, entonces redirecciona al servidor de reportes
                string pass = Session["Pass"] != null ? Session["Pass"].ToString() : "";
                Response.Redirect(dirServerReportes + "Redirecciona.aspx?LoginRedir=" + this.UsuarioConectadoID + "&p=" + pass + "&Pagina=ReporteVendedoresCartera.aspx");
            }

            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "reporteVendedorCartera";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            LlenarHashMeses();

            if (!Page.IsPostBack)
            {
                Session["FechaDesde"]             = null;
                Session["FechaHasta"]             = null;
                Session["DsVentasAgenciasPorMes"] = null;
                Session["DsVentas"]                 = null;
                Session["MesesAmostrar"]            = null;
                Session["DsVentasDetalleUVenta"]    = null;
                Session["VendedorID"]               = null;
                Session["DsCarteraVendedorDetalle"] = null;

                Session["Resto"] = -1;
                CargarCategoria();
                CargarUnidadesVentas();
                this.butExportarExcel.Enabled = false;
            }
            else
            {
                this.butExportarExcel.Enabled = true;
            }

            IUsuarios usuario = (IUsuarios)Session["Usuario"];

            if (usuario.VendedorID != 0)
            {
                IVendedor vendedor = VendedorFactory.GetVendedor();
                vendedor.VendedorID = usuario.VendedorID;
                vendedor.Consultar();
                this.busqVendedor.ApellidoNombre = vendedor.Apellido + ", " + vendedor.Nombre;
                this.busqVendedor.Codigo         = vendedor.NroLegajo;
                this.busqVendedor.VendedorID     = vendedor.VendedorID.ToString();

                ((TextBox)((Control)busqVendedor).FindControl("txtCodigo")).Enabled         = false;
                ((TextBox)((Control)busqVendedor).FindControl("txtApellidoNombre")).Enabled = false;
            }
        }
コード例 #4
0
        private void CargarVendedor(IVendedor vendedor)
        {
            this.txtNombre.Text    = vendedor.Nombre;
            this.txtApellido.Text  = vendedor.Apellido;
            this.txtNroLegajo.Text = vendedor.NroLegajo;
            if (vendedor.Supervisor.VendedorID != 0)
            {
                IVendedor supervisor = VendedorFactory.GetVendedor();
                supervisor.VendedorID = vendedor.Supervisor.VendedorID;

                if (supervisor.Consultar())
                {
                    this.busqSupervisor.Codigo         = supervisor.NroLegajo;
                    this.busqSupervisor.VendedorID     = supervisor.VendedorID.ToString();
                    this.busqSupervisor.ApellidoNombre = supervisor.Apellido + " " + supervisor.Nombre;
                    this.busqSupervisor.EmpActual      = vendedor.VendedorID.ToString();
                }
            }
            this.chkEsSupervisor.Checked = vendedor.EsSupervisor;
            if (vendedor.AgenciaID != 0)
            {
                this.txtNroSucursal.Text = vendedor.NroLegajo.Substring(1, vendedor.NroLegajo.Length - 1);
                SetearSoloLectura();
            }
            this.txtAgenciaID.Text = vendedor.AgenciaID.ToString();
            IDatosDomicilio domicilio = (IDatosDomicilio)phDomicilio.FindControl("domicilio");

            domicilio.DomicilioID = vendedor.Domicilio.DomicilioID;
            domicilio.Calle       = vendedor.Domicilio.Calle;
            domicilio.CalleNro    = vendedor.Domicilio.CalleNro;
            domicilio.Telefono    = vendedor.Domicilio.Telefono;
            domicilio.ProvinciaID = vendedor.Domicilio.Localidad.Provincia.ProvinciaID;
            domicilio.LocalidadID = vendedor.Domicilio.Localidad.LocalidadID;
            domicilio.Fax         = vendedor.Domicilio.Fax;
            domicilio.Depto       = vendedor.Domicilio.Depto;

            //unidades de venta Asociados al vendedor
            if (vendedor.UnidadesVentaCol.getCount() > 0)
            {
                for (int i = 0; i < vendedor.UnidadesVentaCol.getCount(); i++)
                {
                    IUnidadVenta unidadVenta = vendedor.UnidadesVentaCol.GetUnidadVenta(i);
                    for (int j = 0; j < this.lstUnidadesVenta.Items.Count; j++)
                    {
                        if (this.lstUnidadesVenta.Items[j].Value == unidadVenta.UnidadVentaID.ToString())
                        {
                            this.lstUnidadesVenta.Items[j].Selected = true;
                        }
                    }
                }
            }

            //cuota mensual

            this.txtCuotaMensual.Text = vendedor.CuotaMensual.ToString();
        }
コード例 #5
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(dtgComisionVendedores, "VendedorID", this.CantidadOpciones);

            IVendedor oVendedor = VendedorFactory.GetVendedor();

            oVendedor.Apellido  = this.txtApellido.Text;
            oVendedor.NroLegajo = this.txtNroLegajo.Text == "" ? "0" : this.txtNroLegajo.Text;
            this.dtgComisionVendedores.DataSource = oVendedor.GetVendedoresConsultaDataSet();
            this.dtgComisionVendedores.DataBind();
        }
コード例 #6
0
        private void EditarVendedor()
        {
            IVendedor vendedor = VendedorFactory.GetVendedor();

            vendedor.VendedorID = Utiles.Validaciones.obtieneEntero(this.txtVendedorID.Text);
            vendedor.Consultar();

            this.lblLegajo.Text   = vendedor.NroLegajo;
            this.lblNombre.Text   = vendedor.Nombre;
            this.lblApellido.Text = vendedor.Apellido;
        }
コード例 #7
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(dtgVendedores, "VendedorID", this.CantidadOpciones);
            IVendedor oVendedor = VendedorFactory.GetVendedor();

            oVendedor.Apellido = this.txtApellido.Text;
            //oVendedor.VendedorID = this.txtVendedorID.Text == "" ? 0 : Convert.ToInt32(this.txtVendedorID.Text);
            oVendedor.NroLegajo           = this.txtNroLegajo.Text == "" ? "0" : this.txtNroLegajo.Text;
            this.dtgVendedores.DataSource = oVendedor.GetVendedoresConsultaDataSet();            //.Datos.Select("","Apellido");
            Session["DsVendedores"]       = (DsVendedores)this.dtgVendedores.DataSource;
            this.dtgVendedores.DataBind();
        }
コード例 #8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            #region IsAuthenticated

            if (Session["Usuario"] != null)
            {
                usuario = (IUsuarios)Session["Usuario"];
            }

            if (User.Identity.IsAuthenticated)
            {
                string sOpcion = "ReporteAlertaOperativaAgenciaUV";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            agenciaID = usuario.AgenciaID; //Paso la agencia a una variable para después consultar de esa agencia especificamente

            IVentas ventas = VentasFactory.GetVentas();

            /*validar cuando entra un vendedor*/
            if (usuario.VendedorID != 0)
            {
                #region Vendedor
                IVendedor vendedor = VendedorFactory.GetVendedor();
                vendedor.VendedorID = usuario.VendedorID;
                vendedor.Consultar();
                #endregion
            }
            else if (usuario.AgenciaID != 0 && usuario.AgenciaID != ventas.EsAdministracion(UnidadNegocioID))
            {
                IAgencia agencia = AgenciaFactory.GetAgencia();
                agencia.AgenciaID = usuario.AgenciaID;
                agencia.ConsultarBasicoByAgenciaID();
                busqAgencia.AgenciaID   = agencia.AgenciaID.ToString();
                busqAgencia.Sucursal    = agencia.SucursalDGI;
                busqAgencia.RazonSocial = agencia.RazonSocial;
                ((TextBox)((Control)busqAgencia).FindControl("txtSucursal")).Enabled    = false;
                ((TextBox)((Control)busqAgencia).FindControl("txtRazonSocial")).Enabled = false;
            }

            #endregion

            if (!IsPostBack)
            {
                Session["dsResultado"] = null;
                this.BindGrid(0, false);
            }
        }
コード例 #9
0
        private void BindGrilla()
        {
            //SisPackController.AdministrarGrillas.Configurar(this.dtgUnidadesVenta, "UnidadVentaID", this.CantidadOpciones);
            //this.dtgUnidadesVenta.AllowPaging = false;

            SisPackController.AdministrarGrillas.ConfigurarChica(this.dtgUnidadesVenta, "UnidadVentaID");

            IVendedor vendedor = VendedorFactory.GetVendedor();

            vendedor.VendedorID                    = Utiles.Validaciones.obtieneEntero(this.txtVendedorID.Text);
            this.dsVendedorUVenta                  = vendedor.GetUnidadesVenta();
            Session["dsVendedorUVenta"]            = this.dsVendedorUVenta;
            this.dtgUnidadesVenta.DataSource       = this.dsVendedorUVenta;
            this.dtgUnidadesVenta.CurrentPageIndex = 0;
            this.dtgUnidadesVenta.DataBind();
        }
コード例 #10
0
        private void Editar()
        {
            vendedorO = VendedorFactory.GetVendedor();
            if (Session["Vendedor"] == null)
            {
                vendedorO.VendedorID = Convert.ToInt32(this.txtVendedorID.Text);
                vendedorO.Consultar();
            }
            else
            {
                vendedorO = (IVendedor)Session["Vendedor"];
            }



            CargarVendedor(vendedorO);
        }
コード例 #11
0
        private void CargarVendedor()
        {
            IVendedor vendedor = VendedorFactory.GetVendedor();

            vendedor.VendedorID = this.vendedorID;

            // SFE. 11/12/2014. Esta variable se introduce para que no cargue todas las unidades de venta en la pagina de convenios de cliente, donde no lo necesita y hace mas lenta la carga de la pagina.
            if (this.Parent.Page.ToString().ToLower().Contains("conveniocliente"))
            {
                vendedor.CargarUnidadesDeVenta = false;
            }
            vendedor.Consultar();

            this.txtVendedorID.Text = vendedor.VendedorID.ToString();
            this.txtLegajo.Text     = vendedor.NroLegajo.ToString();
            this.txtNombre.Text     = vendedor.Nombre;
            this.txtApellido.Text   = vendedor.Apellido;
        }
コード例 #12
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgSupervisores, "VendedorID", this.CantidadOpciones);
            try
            {
                IVendedor    supervisor = VendedorFactory.GetVendedor();
                DsVendedores ds         = supervisor.GetVendedoresDataSet();

                string codigo    = this.txtCodigo.Text;
                string apeNom    = this.txtApellidoNombre.Text;
                string filtro    = this.txtFiltro.Text;
                string empActual = this.txtEmpActual.Text;
                if (codigo != "")                                                                                                       //Codigo LIKE '" + codi + "%'
                {
                    filtro = "NroLegajo LIKE '" + codigo + "%' AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')"; //aure
                }
                //filtro = "VendedorID = " + codigo + " AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')";
                else
                {
                    filtro = "(Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')";
                }

                if (this.txtEmpActual.Text != "")
                {
                    filtro += " AND VendedorID <> " + empActual;
                }

                //DEBE TENER EL ATRIBUTO DE SUPERVISOR EN "SI", siempre que venga de consulta de Vendedores
                if (this.txtFiltro.Text == "")
                {
                    filtro += " AND EsSupervisor=true";
                }

                DsVendedores.DatosRow[] drLista = (DsVendedores.DatosRow[])ds.Datos.Select(filtro);

                this.dtgSupervisores.DataSource = drLista;
                this.dtgSupervisores.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
                //this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message;
            }
        }
コード例 #13
0
        /// <summary>
        /// Procedimiento para cargar las listas
        /// </summary>
        private void LlenarListas()
        {
            // Cargo las agencias
            IAgencia agencias = AgenciaFactory.GetAgencia();

            lstAgencia.DataSource     = agencias.GetAgenciasDataSet().Datos.Select("", "RazonSocial");
            lstAgencia.DataValueField = "AgenciaId";
            lstAgencia.DataTextField  = "RazonSocial";
            lstAgencia.DataBind();
            // Cargo los vendedores
            IVendedor vendedores = VendedorFactory.GetVendedor();

            lstVendedor.DataSource     = vendedores.GetVendedoresDataSet();
            lstVendedor.DataValueField = "VendedorID";
            lstVendedor.DataTextField  = "Nombre";
            lstVendedor.DataBind();
            // Cargo las unidades de ventas
            LlenarCombos.UnidadesVenta(lstUnidadVenta);
            LlenarCombos.ConceptoFacturacion(lstConceptos, this.UnidadNegocioID);
        }
コード例 #14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "liquidacionConsul";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            if (!IsPostBack)
            {
                this.lblFechaActual.Text = System.DateTime.Today.ToString("dd/MM/yyyy");

                this.txtTipoEntidadID.Text = Request.QueryString["TipoEntidadID"];
                this.txtEntidadID.Text     = Request.QueryString["EntidadID"];

                if (this.txtTipoEntidadID.Text == "1")               //TipoEntidad = 1 es una liquidacion para una agencia
                {
                    this.lblTituloPagina.Text = this.TraducirTexto("Titulo.LiquidacionAgencia");
                    IAgencia ag = AgenciaFactory.GetAgencia();
                    ag.AgenciaID = Convert.ToInt32(this.txtEntidadID.Text);
                    ag.ConsultarBasico();
                    this.lbl.Text = this.TraducirTexto("Etiquetas.Agencia");
                    this.lblEntidadDescrip.Text = ag.RazonSocial;
                }
                else                //TipoEntidad = 2 es una liquidacion para un vendedor
                {
                    this.lblTituloPagina.Text = this.TraducirTexto("Titulo.LiquidacionVendedor");
                    IVendedor vend = VendedorFactory.GetVendedor();
                    vend.VendedorID = Convert.ToInt32(this.txtEntidadID.Text);
                    vend.Consultar();
                    this.lbl.Text = this.TraducirTexto("Etiquetas.Vendedor");
                    this.lblEntidadDescrip.Text = vend.Nombre + " " + vend.Apellido;
                }
                // Elimino del objeto session DsLiquidacionEntidad
                Session.Remove("DsLiquidacionEntidad");
                BindGrid(0);
            }
            //this.SetearValidadores();
        }
        /// <summary>
        /// Procedimiento para cargar las listas
        /// </summary>
        private void LlenarListas()
        {
            // Cargo las unidades de venta
            LlenarCombos.UnidadesVenta(lstUnidadVenta);
            // Cargo las agencias
            IAgencia agencias = AgenciaFactory.GetAgencia();

            lstAgencias.DataSource     = agencias.GetAgenciasDataSet().Datos.Select("", "RazonSocial");
            lstAgencias.DataValueField = "AgenciaId";
            lstAgencias.DataTextField  = "RazonSocial";
            lstAgencias.DataBind();
            // Cargo los vendedores
            IVendedor    vendedores = VendedorFactory.GetVendedor();
            DsVendedores ds         = vendedores.GetVendedoresDataSet();

            foreach (DsVendedores.DatosRow dr in ds.Datos.Select("", "nombre, apellido"))
            {
                ListItem item = new ListItem(dr.Nombre + " " + dr.Apellido, dr.VendedorID.ToString());
                lstVendedores.Items.Add(item);
            }
        }
コード例 #16
0
        private void butAceptar_Click(object sender, System.EventArgs e)
        {
            IVendedor vendedor = VendedorFactory.GetVendedor();

            vendedor.VendedorID    = Convert.ToInt32(this.txtVendedor.Text);
            vendedor.FechaBajaReal = new DateTime(Convert.ToInt32(txtFecha.Text.Substring(6, 4)), Convert.ToInt32(txtFecha.Text.Substring(3, 2)), Convert.ToInt32(txtFecha.Text.Substring(0, 2)));
            vendedor.Consultar();

            try
            {
                vendedor.Eliminar(usuario);
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
                return;
            }

            Page.RegisterStartupScript("muestraMensaje", SisPackController.GenerarJavaScripts.MostrarMensaje("El vendedor se eliminó correctamente."));
            StringBuilder scriptString = new StringBuilder();

            scriptString.Append("<script language='javascript'>\n");
            scriptString.Append("window.close();\n");
            scriptString.Append("</script>");
            Page.RegisterStartupScript("LlamadaCerrar" + this.ID, scriptString.ToString());
        }
コード例 #17
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "conceptosLiqAgenciaAlta";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            if (!IsPostBack)
            {
                Session["dsConceptosEntidad"] = null;
                this.txtTipoEntidadID.Text    = this.Request.QueryString["TipoEntidadID"];
                this.txtEntidadID.Text        = this.Request.QueryString["EntidadID"];

                if (this.txtTipoEntidadID.Text == "1")
                {
                    IAgencia oAgencia = AgenciaFactory.GetAgencia();
                    oAgencia.AgenciaID = Convert.ToInt32(this.txtEntidadID.Text);
                    oAgencia.ConsultarBasico();
                    this.lbl.Text = TraducirTexto("Etiquetas.Agencia");
                    this.lblEntidadDescrip.Text = oAgencia.RazonSocial;
                }
                else
                {
                    IVendedor oVendedor = VendedorFactory.GetVendedor();
                    oVendedor.VendedorID = Convert.ToInt32(this.txtEntidadID.Text);
                    oVendedor.Consultar();
                    this.lbl.Text = TraducirTexto("Etiquetas.Vendedor");
                    this.lblEntidadDescrip.Text = oVendedor.Apellido + " " + oVendedor.Nombre;
                }
            }
            if (this.txtTipoEntidadID.Text != "" && this.txtTipoEntidadID.Text != null)
            {
                this.BindGrid();
            }
        }
コード例 #18
0
        private void BindGrid()
        {
            hashMeses = (Hashtable)Session["Meses"];

            ICarteraVendedor vendedorCartera = CarteraVendedorFactory.GetCarteraVendedor();

            vendedorCartera.FechaDesde = this.txtFechaDesde.Text == "" ? Utiles.Fechas.FormatFechaDDMMYYYY("01/01/1900") : Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaDesde.Text);
            vendedorCartera.FechaHasta = this.txtFechaHasta.Text == "" ? Utiles.Fechas.FormatFechaDDMMYYYY("01/12/2050") : Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text);

            Session["FechaDesde"]  = vendedorCartera.FechaDesde;
            Session["FechaHasta"]  = vendedorCartera.FechaHasta;
            Session["CategoriaID"] = Utiles.Validaciones.obtieneEntero(ddlCategoria.SelectedValue);

            int  mesDesde  = 0;
            int  mesHasta  = 0;
            bool banderita = false;
            int  cantMeses = 0;            //cantidad de meses a mostrar
            int  resto     = (int)Session["Resto"];

            // se piden meses del mismo año
            if (vendedorCartera.FechaDesde.Year == 1900 || vendedorCartera.FechaHasta.Year == 2050)
            {
                mesDesde = vendedorCartera.FechaDesde.Month <= vendedorCartera.FechaHasta.Month ? vendedorCartera.FechaDesde.Month : vendedorCartera.FechaHasta.Month;
                mesHasta = vendedorCartera.FechaDesde.Month <= vendedorCartera.FechaHasta.Month ? vendedorCartera.FechaHasta.Month : vendedorCartera.FechaDesde.Month;
            }
            else if (vendedorCartera.FechaDesde.Year == vendedorCartera.FechaHasta.Year)
            {
                mesDesde = vendedorCartera.FechaDesde.Month <= vendedorCartera.FechaHasta.Month ? vendedorCartera.FechaDesde.Month : vendedorCartera.FechaHasta.Month;
                mesHasta = vendedorCartera.FechaDesde.Month <= vendedorCartera.FechaHasta.Month ? vendedorCartera.FechaHasta.Month : vendedorCartera.FechaDesde.Month;
            }
            else             // se piden meses de años distintos
            {
                if (vendedorCartera.FechaDesde.Year > vendedorCartera.FechaHasta.Year)
                {
                    throw new Exception("Error!");                     //si el año inicial es menor que el final, error
                }
                else
                {
                    // si el mes inicial es menor o igual que el final, mostrar todos los meses
                    // o si la diferencias de años es mayor que 1
                    if (vendedorCartera.FechaDesde.Month <= vendedorCartera.FechaHasta.Month || vendedorCartera.FechaHasta.Year - vendedorCartera.FechaDesde.Year > 1)
                    {
                        banderita = true;
                        for (int m = 1; m <= 12; m++)
                        {
                            meses[m] = true;
                        }
                        cantMeses = 12;
                    }
                    else                     // si el mes final es mayor que el final....
                    {
                        banderita = true;

                        for (int m = 1; m <= 12; m++)
                        {
                            if (m >= vendedorCartera.FechaDesde.Month && m <= 12)
                            {
                                meses[m] = true;
                                cantMeses++;
                            }
                            else if (m <= vendedorCartera.FechaHasta.Month)
                            {
                                meses[m] = true;
                                cantMeses++;
                            }
                            else
                            {
                                meses[m] = false;
                            }
                        }
                    }
                }
            }

            // esto es para cuando los años ingresados son iguales
            if (!banderita)
            {
                for (int m = 1; m <= 12; m++)
                {
                    if (m >= vendedorCartera.FechaDesde.Month && m <= vendedorCartera.FechaHasta.Month)
                    {
                        meses[m] = true;
                        cantMeses++;
                    }
                    else
                    {
                        meses[m] = false;
                    }
                }
            }

            string orden = "";
            int    ordenar;

            if (this.rbtOrdenAlfabetico.Checked)
            {
                if (this.ddlOrdenAlfabetico.SelectedIndex == 0)
                {
                    ordenar = 1;
                }
                else
                {
                    ordenar = 2;
                }
            }
            else
            {
                if (this.ddlOrdenFacturacion.SelectedIndex == 0)
                {
                    ordenar = 3;
                }
                else
                {
                    ordenar = 4;
                }
            }

            Session["MesesAmostrar"]                  = meses;
            vendedorCartera.VendedorID                = this.busqVendedor.VendedorID == "" ? 0 : Convert.ToInt32(this.busqVendedor.VendedorID);
            vendedorCartera.UnidadVentaID             = Utiles.Validaciones.obtieneEntero(this.ddlUnidadVenta.SelectedValue);
            Session["DsCarteraVendedorDetalleUVenta"] = vendedorCartera.GetCarteraVendedorDetalleUVenta(Utiles.Validaciones.obtieneEntero(this.ddlUnidadVenta.SelectedValue), Utiles.Validaciones.obtieneEntero(ddlCategoria.SelectedValue));
            Session["VendedorID"] = vendedorCartera.VendedorID;
            DataSet ds = new DataSet();

            SisPackController.AdministrarGrillas.Configurar(this.hgVendedoresCartera, "VendedorID", this.CantidadOpciones);

            this.hgVendedoresCartera.AllowPaging = false;

            //Vendedores
            IVendedor    vendedor     = VendedorFactory.GetVendedor();
            DsVendedores dsVendedores = null;

            dsVendedores = vendedor.GetVendedoresDataSet(vendedorCartera.FechaDesde, vendedorCartera.FechaHasta, vendedorCartera.UnidadVentaID, vendedorCartera.VendedorID, ordenar);

            ds.Tables.Add(dsVendedores.Datos.Clone());
            ds.Tables[0].TableName = "Vendedores";

            foreach (System.Data.DataRow row in dsVendedores.Datos.Rows)
            {
                ds.Tables["Vendedores"].ImportRow(row);
            }

            //Cuentas
            //ICarteraVendedor vendedorCartera = VendedorCarteraFactory.GetVendedorCartera();
            DsCarteraVendedor dsVendedoresCartera = vendedorCartera.GetCarteraVendedorDetalle(Utiles.Validaciones.obtieneEntero(ddlCategoria.SelectedValue));

            Session["DsCarteraVendedorDetalle"] = dsVendedoresCartera;
            ds.Tables.Add(dsVendedoresCartera.Datos.Clone());
            ds.Tables[1].TableName = "CarteraVendedorDetalle";

            foreach (System.Data.DataRow row in dsVendedoresCartera.Datos.Rows)
            {
                ds.Tables["CarteraVendedorDetalle"].ImportRow(row);
            }

            //Relacion Agencias => GuiasTDE
            DataColumn dc1 = ds.Tables[0].Columns["VendedorID"];

            DataColumn dc2 = ds.Tables[1].Columns["VendedorID"];

            DataRelation dr = new DataRelation("Vendedor_VendedorCartera", dc1, dc2, false);

            ds.Relations.Add(dr);

            this.hgVendedoresCartera.DataSource  = ds;
            this.hgVendedoresCartera.DataMember  = "Vendedores";
            this.hgVendedoresCartera.AllowPaging = false;
            this.hgVendedoresCartera.DataBind();
        }
コード例 #19
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string permiteReportes   = System.Configuration.ConfigurationSettings.AppSettings["Server"];
            string dirServerReportes = System.Configuration.ConfigurationSettings.AppSettings["DirServerReportes"];

            if (permiteReportes == "P")
            {
                // si no permite reportes, entonces redirecciona al servidor de reportes
                string pass = Session["Pass"] != null ? Session["Pass"].ToString() : "";
                Response.Redirect(dirServerReportes + "Redirecciona.aspx?LoginRedir=" + this.UsuarioConectadoID + "&p=" + pass + "&Pagina=ReporteAlertaVentas.aspx");
            }

            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "reporteAlertaVentas";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }

            if (!Page.IsPostBack)
            {
                CargarCategoria();
                CargarUnidadesVentas();
            }

            ScriptMostrar();
            RegistrarLimpiarAgencia();
            RegistrarLimpiarVendedor();
            RegistrarLimpiarCliente();
            SetearValidadores();

            IUsuarios usuario = (IUsuarios)Session["Usuario"];

            if (usuario.VendedorID != 0)
            {
                this.tblAgencia.Attributes.Add("Style", "Display: none");
                this.tblVendedor.Attributes.Add("Style", "Display: inline");
                this.tblCliente.Attributes.Add("Style", "Display: inline");

                this.rbtVendedores.Attributes.Add("onclick", "mostrar();");

                IVendedor vendedor = VendedorFactory.GetVendedor();
                vendedor.VendedorID = usuario.VendedorID;
                vendedor.Consultar();
                this.busqVendedor.ApellidoNombre = vendedor.Apellido + ", " + vendedor.Nombre;
                this.busqVendedor.Codigo         = vendedor.NroLegajo;
                this.busqVendedor.VendedorID     = vendedor.VendedorID.ToString();

                this.rbtAgencias.Attributes.Add("Style", "display: none");
                this.rbtClientes.Attributes.Add("Style", "display: none");

                ((TextBox)((Control)busqVendedor).FindControl("txtCodigo")).Enabled         = false;
                ((TextBox)((Control)busqVendedor).FindControl("txtApellidoNombre")).Enabled = false;

                this.busqCliente.Visible = false;
                this.lblCliente.Visible  = false;

                this.rbtVendedores.Checked = true;
            }
            else
            {
                this.rbtAgencias.Attributes.Add("onclick", "mostrar();LimpiarAgencia();");
                this.rbtVendedores.Attributes.Add("onclick", "mostrar();LimpiarVendedor();");
                this.rbtClientes.Attributes.Add("onclick", "mostrar();LimpiarCliente();");
            }
        }
コード例 #20
0
        private void BindVendedores(int currentPageIndex)
        {
            try
            {
                int    vendedorID     = (busqVendedor.VendedorID == "") ? 0 : Convert.ToInt32(busqVendedor.VendedorID);
                string nroLegajo      = busqVendedor.Codigo;
                string apellidoNombre = busqVendedor.ApellidoNombre;

                DataSet dsHG = new DataSet();
                SisPackController.AdministrarGrillas.Configurar(this.hgVendedores, "VendedorID", this.CantidadOpciones);

                IVendedor vendedor = VendedorFactory.GetVendedor();

                vendedor.VendedorID = (busqVendedor.VendedorID == "") ? 0 : Convert.ToInt32(busqVendedor.VendedorID);
                vendedor.NroLegajo  = busqVendedor.Codigo;
                vendedor.Apellido   = busqVendedor.ApellidoNombre;

                DsVendedores dsVendedores = new DsVendedores();
                dsVendedores = vendedor.GetVendedoresUVenta();

                dsHG.Tables.Add(dsVendedores.Datos.Clone());

                dsHG.Tables[0].TableName = "Vendedores";

                foreach (System.Data.DataRow row in dsVendedores.Datos.Rows)
                {
                    dsHG.Tables["Vendedores"].ImportRow(row);
                }

                IVendedorUVenta uniVenta = VendedorUVentaFactory.GetVendedorUVenta();

                DsVendedorUVenta dsUnidadesVenta = new DsVendedorUVenta();
                dsUnidadesVenta = uniVenta.GetUnidadesVenta(vendedorID, nroLegajo, apellidoNombre);

                dsHG.Tables.Add(dsUnidadesVenta.Datos.Clone());

                dsHG.Tables[1].TableName = "Detalle";

                foreach (System.Data.DataRow row in dsUnidadesVenta.Datos.Rows)
                {
                    dsHG.Tables["Detalle"].ImportRow(row);
                }

                DataColumn dc1 = dsHG.Tables[0].Columns["VendedorID"];

                DataColumn dc2 = dsHG.Tables[1].Columns["VendedorID"];

                DataRelation dr = new DataRelation("Vendedor_UnidadVenta", dc1, dc2, false);
                dsHG.Relations.Add(dr);

                this.hgVendedores.CurrentPageIndex = currentPageIndex;
                this.hgVendedores.DataSource       = dsHG;
                this.hgVendedores.DataMember       = "Vendedores";
                this.hgVendedores.DataBind();
                this.hgClientes.Visible   = false;
                this.hgVendedores.Visible = true;
                this.dtgAgencias.Visible  = false;
            }
            catch (Exception ex)
            {
                ManejaErrores(ex);
            }
        }
コード例 #21
0
        private void Editar()
        {
            IUsuarios usuario = UsuariosFactory.GetUsuario();

            usuario.UsuarioID = Utiles.Validaciones.obtieneEntero(this.txtUsuarioID.Text);
            usuario.Consultar();

            // seteo los atributos del usuario en la pagina
            this.txtUsuarioID.Text       = usuario.UsuarioID.ToString();
            this.txtApellido.Text        = usuario.Apellido;
            this.txtEmail.Text           = usuario.Email;
            this.txtLogin.Text           = usuario.Login;
            this.txtNombre.Text          = usuario.Nombre;
            this.cmbEstado.SelectedValue = usuario.EstadoUsuarioPerfilID.ToString();


            ///faltannnnn
            ///TODO: FALTA TRAER LA UNegocio del usuario: sacada hasta ver que no hayan creado ningún usuario con la UNEgocio: Petrobus
            this.cmbUnidadNegocio.SelectedValue = usuario.UnidadNegocioID.ToString();             //descomentar esto cuando se haga el control de la UNegocio
            if (usuario.AgenciaID != 0)
            {
                IAgencia oAgencia = AgenciaFactory.GetAgencia();
                oAgencia.AgenciaID = usuario.AgenciaID;

                oAgencia.ConsultarBasico();
                this.busqAgencia.AgenciaID   = oAgencia.AgenciaID.ToString();
                this.busqAgencia.Sucursal    = oAgencia.SucursalDGI;
                this.busqAgencia.RazonSocial = oAgencia.RazonSocial;
                this.rbtAgencias.Checked     = true;
//				this.tblCliente.Visible=false;
//				this.tblVendedor.Visible=false;
//				this.tblNinguno.Visible=false;
            }
            else if (usuario.VendedorID != 0)
            {
                IVendedor oVendedor = VendedorFactory.GetVendedor();
                oVendedor.VendedorID = usuario.VendedorID;

                oVendedor.Consultar();
                this.busqVendedor.VendedorID     = oVendedor.VendedorID.ToString();
                this.busqVendedor.Codigo         = oVendedor.NroLegajo;
                this.busqVendedor.ApellidoNombre = oVendedor.Apellido + " " + oVendedor.Nombre;
                this.rbtVendedores.Checked       = true;
//				this.tblCliente.Visible=false;
//				this.tblAgencia.Visible=false;
//				this.tblNinguno.Visible=false;
            }
            else if (usuario.ClienteID != 0)
            {
                ICliente oCliente = ClienteFactory.GetCliente();
                oCliente.ClienteID = usuario.ClienteID;

                oCliente.Consultar();
                this.busqCliente.ClienteID   = oCliente.ClienteID.ToString();
                this.busqCliente.Codigo      = oCliente.Codigo;
                this.busqCliente.RazonSocial = oCliente.RazonSocial;
                this.rbtCliente.Checked      = true;
//				this.tblVendedor.Visible=false;
//				this.tblAgencia.Visible=false;
//				this.tblNinguno.Visible=false;

                //si el lciente tiene asociada una agencia de retiro la muestro
                if (usuario.AgenciaRetiroID != 0)
                {
                    IAgencia oAgencia = AgenciaFactory.GetAgencia();
                    oAgencia.AgenciaID = usuario.AgenciaRetiroID;

                    oAgencia.ConsultarBasico();
                    this.busqAgenciaRetiro.AgenciaID   = oAgencia.AgenciaID.ToString();
                    this.busqAgenciaRetiro.Sucursal    = oAgencia.SucursalDGI;
                    this.busqAgenciaRetiro.RazonSocial = oAgencia.RazonSocial;
                }
            }
            else
            {
                this.rbtNinguno.Checked = true;
//				this.tblVendedor.Visible=false;
//				this.tblAgencia.Visible=false;
//				this.tblCliente.Visible=false;
            }
        }
コード例 #22
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgSupervisores, "VendedorID", this.CantidadOpciones);
            try
            {
                int          total      = 0;
                IVendedor    supervisor = VendedorFactory.GetVendedor();
                DsVendedores ds         = supervisor.GetVendedoresDataSet();

                //string codigo = this.txtCodigo.Text;
                //string apeNom = this.txtApellidoNombre.Text;
                //string filtro = this.txtFiltro.Text;
                //string empActual = this.txtEmpActual.Text;
                if (codigo == "")
                {
                    codigo = this.txtCodigo.Text;
                }
                if (apeNom == "")
                {
                    apeNom = this.txtApellidoNombre.Text;
                }

                if (codigo != "")                                                                                                       //Codigo LIKE '" + codi + "%'
                {
                    filtro = "NroLegajo LIKE '" + codigo + "%' AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')"; //aure
                }
                //filtro = "VendedorID = " + codigo + " AND (Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')";
                else
                {
                    filtro = "(Apellido LIKE '" + apeNom + "%' OR Nombre LIKE '" + apeNom + "%')";
                }

                if (this.txtEmpActual.Text != "")
                {
                    filtro += " AND VendedorID <> " + empActual;
                }

                //DEBE TENER EL ATRIBUTO DE SUPERVISOR EN "SI", siempre que venga de consulta de Vendedores
                if (this.txtFiltro.Text == "")
                {
                    filtro += " AND EsSupervisor=true";
                }

                DsVendedores.DatosRow[] drLista = (DsVendedores.DatosRow[])ds.Datos.Select(filtro);

                this.dtgSupervisores.DataSource = drLista;
                this.dtgSupervisores.DataBind();


                // se agrego para eliminar el ShowModalDialog
                total        = drLista.Length;
                txtFila.Text = Convert.ToString(total);

                if (total == 1)
                {
                    DsVendedores.DatosRow dr = drLista[0];
                    this.txtVendedorID.Text     = dr.VendedorID.ToString();
                    this.txtCodigo.Text         = dr.NroLegajo;
                    this.txtApellidoNombre.Text = dr.Nombre + ',' + dr.Apellido;
                }
                else
                {
                    this.txtCodigo.Text         = this.codigo;
                    this.txtApellidoNombre.Text = this.apeNom;
                }
            }
            catch (Exception ex)
            {
                throw ex;
                //this.txtErrorMsg.Text = "Error al consultar datos de responsables: " + ex.Message;
            }
        }
コード例 #23
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            this.lblFechaActual.Text = DateTime.Today.ToString("dd/MM/yyyy");
            if (this.Request.QueryString["VendedorID"] != null && this.Request.QueryString["AgenciaID"] == null)
            {
                #region EsVendedor
                IVendedor vendedor = VendedorFactory.GetVendedor();
                vendedor.VendedorID = Convert.ToInt32(this.Request.QueryString["VendedorID"].ToString());
                vendedor.Consultar();
                this.lblTitulo.Text = "Vendedor: " + vendedor.NroLegajo.ToString() + " - " + vendedor.Nombre + " " + vendedor.Apellido;

                if (User.Identity.IsAuthenticated)
                {
                    string sOpcion = "evaluacionObjetivosIncentivosVendedores";
                    Menu   oMenu   = (Menu)this.FindControl("Menu1");
                    this.ValidarSeguridad(oMenu, sOpcion);
                }
                if (!IsPostBack)
                {
                    //this.BindGrillaObjetivosVendedor();
                    //this.BindGrillaIncentivosVendedor();
                    tdObjetivos.Attributes.Add("STYLE", "DISPLAY:none");
                    tdIncentivos.Attributes.Add("STYLE", "DISPLAY:none");
                    LlenarObjetivo();
                    LlenarIncentivo();
                }
                #endregion
            }
            else if (this.Request.QueryString["VendedorID"] == null && this.Request.QueryString["AgenciaID"] != null)
            {
                #region EsAgencia
                IAgencia agencia = AgenciaFactory.GetAgencia();
                agencia.AgenciaID = Convert.ToInt32(this.Request.QueryString["AgenciaID"].ToString());
                agencia.ConsultarBasicoByAgenciaID();
                this.lblTitulo.Text = "Agencia: " + agencia.SucursalDGI.ToString() + " - " + agencia.RazonSocial;

                if (User.Identity.IsAuthenticated)
                {
                    string sOpcion = "evaluacionObjetivosIncentivosAgencias";
                    Menu   oMenu   = (Menu)this.FindControl("Menu1");
                    this.ValidarSeguridad(oMenu, sOpcion);
                }
                if (!IsPostBack)
                {
                    //this.BindGrillaObjetivosAgencia();
                    //this.BindGrillaIncentivosAgencia();
                    tdObjetivos.Attributes.Add("STYLE", "DISPLAY:none");
                    tdIncentivos.Attributes.Add("STYLE", "DISPLAY:none");
                    LlenarObjetivo();
                    LlenarIncentivo();
                }
                #endregion
            }
            else if (Request.QueryString["PersonalID"] != null)
            {
                #region Personal
                IPersonal personal = PersonalFactory.GetPersonalFactory();
                personal.PersonalID = Utiles.Validaciones.obtieneEntero(Request.QueryString["PersonalID"]);
                personal.Consultar();
                lblTitulo.Text = "Personal: " + personal.Nombre + " " + personal.Apellido;

                if (User.Identity.IsAuthenticated)
                {
                    string sOpcion = "evaluacionObjetivosIncentivosPersonal";
                    Menu   oMenu   = (Menu)this.FindControl("Menu1");
                    this.ValidarSeguridad(oMenu, sOpcion);
                }

                if (!IsPostBack)
                {
                    tdObjetivos.Attributes.Add("STYLE", "DISPLAY:none");
                    LlenarObjetivo();
                }
                tdIncentivos.Attributes.Add("STYLE", "DISPLAY:none");
                lblIncentivo.Attributes.Add("STYLE", "DISPLAY:none");
                ddlIncentivo.Attributes.Add("STYLE", "DISPLAY:none");
                #endregion
            }
            SetearValidadores();
        }
コード例 #24
0
        /// <summary>
        /// Guardar datos del vendedor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void butGuardarVendedor_Click(object sender, System.EventArgs e)
        {
            BaseValidator ValidCuotaMensual = (BaseValidator)this.phCuotaMensual.FindControl("ValidCuotaMensual");

            ValidCuotaMensual.Enabled = true;
            ValidCuotaMensual.Validate();
            if (!ValidCuotaMensual.IsValid)
            {
                return;
            }

            if (!Page.IsValid)
            {
                return;
            }

            IVendedor vendedor = VendedorFactory.GetVendedor();

            vendedor.VendedorID = this.txtVendedorID.Text == "" ? 0 : Convert.ToInt32(this.txtVendedorID.Text);
            vendedor.Nombre     = this.txtNombre.Text;
            vendedor.Apellido   = this.txtApellido.Text;
            vendedor.NroLegajo  = this.txtNroLegajo.Text;
            //vendedor.NroLegajo = nroLegajo== 0 ? this.txtNroLegajo.Text : nroLegajo.ToString();
            vendedor.Supervisor.VendedorID = this.busqSupervisor.Codigo == "" ? 0 : Convert.ToInt32(this.busqSupervisor.VendedorID);
            vendedor.EsSupervisor          = this.chkEsSupervisor.Checked;
            if (this.txtAgenciaID.Text == "" || this.txtAgenciaID.Text == "0")
            {
                Control dom = this.phDomicilio.FindControl("domicilio");
                if (!((IValidar)dom).Validar(true))
                {
                    return;
                }
            }
            vendedor.AgenciaID = this.txtAgenciaID.Text == "" ? 0 : Convert.ToInt32(this.txtAgenciaID.Text);
            if (vendedor.EstadoVendedor == NegociosSisPackInterface.SisPack.EstadoVendedor.Ninguno)
            {
                vendedor.EstadoVendedor = NegociosSisPackInterface.SisPack.EstadoVendedor.Habilitado;
            }

            //Carga de domicilio
            IDatosDomicilio domicilio = (IDatosDomicilio)this.phDomicilio.FindControl("domicilio");

            vendedor.Domicilio.DomicilioID           = domicilio.DomicilioID;
            vendedor.Domicilio.Calle                 = domicilio.Calle;
            vendedor.Domicilio.CalleNro              = domicilio.CalleNro;
            vendedor.Domicilio.Localidad.LocalidadID = domicilio.LocalidadID;
            vendedor.Domicilio.Telefono              = domicilio.Telefono;
            vendedor.Domicilio.Fax   = domicilio.Fax;
            vendedor.Domicilio.Depto = domicilio.Depto;

            //Cargar la colección de unidades de venta
            for (int i = 0; i < this.lstUnidadesVenta.Items.Count; i++)
            {
                if (this.lstUnidadesVenta.Items[i].Selected)
                {
                    if (this.lstUnidadesVenta.Items[i].Value != "")
                    {
                        IUnidadVenta unidadVenta = vendedor.UnidadesVentaCol.AddUnidadVenta();
                        unidadVenta.UnidadVentaID = Convert.ToInt32(this.lstUnidadesVenta.Items[i].Value);
                        unidadVenta.Consultar();
                    }
                }
            }

            // cargo la cuota mensual
            vendedor.CuotaMensual = Convert.ToDouble(this.txtCuotaMensual.Text);

            try
            {
                if (vendedor.Guardar(usuario))
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos se guardaron correctamente.');\n";
                    script += "window.location.href = 'VendedoresConsul.aspx?OpcionEstado=vendedores';\n";
                    script += "</script>";
                    Page.RegisterStartupScript("scriptOk", script);
                }
                else
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos no se guardaron debido a errores.');\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptError", script);
                }
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }
コード例 #25
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            #region permiteReportes
            string permiteReportes   = System.Configuration.ConfigurationSettings.AppSettings["Server"];
            string dirServerReportes = System.Configuration.ConfigurationSettings.AppSettings["DirServerReportes"];

            if (permiteReportes == "P")
            {
                // si no permite reportes, entonces redirecciona al servidor de reportes
                string pass = Session["Pass"] != null ? Session["Pass"].ToString() : "";
                Response.Redirect(dirServerReportes + "Redirecciona.aspx?LoginRedir=" + this.UsuarioConectadoID + "&p=" + pass + "&Pagina=ListadoMontosVentas.aspx");
            }
            #endregion

            #region User IsAuthenticated
            if (User.Identity.IsAuthenticated)
            {
                //this.SetCultura();
                string sOpcion = "montosVentas";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }
            #endregion

            usuario = (IUsuarios)Session["Usuario"];
            this.tblAgencia.Attributes.Add("Style", "Display: none");
            this.tblVendedor.Attributes.Add("Style", "Display: none");
            this.tblCliente.Attributes.Add("Style", "Display: none");
            this.tblAgrupacionCliente.Attributes.Add("Style", "Display: none");

            if (!IsPostBack)
            {
                this.butExportarExcel.Enabled = false;
                CargarUnidadesVentas();
                CargarConceptosFacturacion();
                CargarCombosOrden();
                CargarCondicionesPago();
                this.LlenarListaZonas();
            }

            SetearValidadores();
            ScriptMostrar();
            RegistrarLimpiarAgencia();
            RegistrarLimpiarVendedor();
            RegistrarLimpiarCliente();
            RegistrarLimpiarAgrupacionCliente();

            IMontoVenta monto = MontoVentaFactory.GetMontoVenta();
            if (usuario.VendedorID != 0)
            {
                #region Vendedor
                this.tblAgencia.Attributes.Add("Style", "Display: none");
                this.tblVendedor.Attributes.Add("Style", "Display: inline");
                this.tblCliente.Attributes.Add("Style", "Display: none");
                this.tblEstadoCartera.Attributes.Add("Style", "Display: none");
                this.tblAgrupacionCliente.Attributes.Add("Style", "Display: none");

                IVendedor vendedor = VendedorFactory.GetVendedor();
                vendedor.VendedorID = usuario.VendedorID;
                vendedor.Consultar();
                this.busqVendedor.ApellidoNombre  = vendedor.Apellido + ", " + vendedor.Nombre;
                this.busqVendedor.Codigo          = vendedor.NroLegajo;
                this.busqVendedor.VendedorID      = vendedor.VendedorID.ToString();
                this.rbtVendedores.Checked        = true;
                this.rbtClientes.Checked          = false;
                this.rbtAgencias.Checked          = false;
                this.rbtAgrupacionCliente.Checked = false;
                this.rbtClientes.Attributes.Add("Style", "display: none");
                this.rbtAgencias.Attributes.Add("Style", "display: none");
                this.rbtAgrupacionCliente.Attributes.Add("Style", "display: none");

                ((TextBox)((Control)busqVendedor).FindControl("txtCodigo")).Enabled         = false;
                ((TextBox)((Control)busqVendedor).FindControl("txtApellidoNombre")).Enabled = false;
                #endregion
            }
            else if (usuario.AgenciaID != 0 && usuario.AgenciaID != monto.EsAdministracion(UnidadNegocioID))
            {
                tblAgencia.Attributes.Add("Style", "Display: inline");
                tblVendedor.Attributes.Add("Style", "Display: none");
                tblCliente.Attributes.Add("Style", "Display: none");
                tblEstadoCartera.Attributes.Add("Style", "Display: none");
                tblAgrupacionCliente.Attributes.Add("Style", "Display: none");

                IAgencia agencia = AgenciaFactory.GetAgencia();
                agencia.AgenciaID = usuario.AgenciaID;
                agencia.ConsultarBasicoByAgenciaID();
                busqAgencia.AgenciaID   = agencia.AgenciaID.ToString();
                busqAgencia.Sucursal    = agencia.SucursalDGI;
                busqAgencia.RazonSocial = agencia.RazonSocial;
                rbtVendedores.Checked   = false;
                rbtClientes.Checked     = false;
                rbtAgencias.Checked     = true;
                rbtClientes.Attributes.Add("Style", "display: none");
                rbtVendedores.Attributes.Add("Style", "display: none");
                rbtAgrupacionCliente.Attributes.Add("Style", "display: none");
                ((TextBox)((Control)busqAgencia).FindControl("txtSucursal")).Enabled    = false;
                ((TextBox)((Control)busqAgencia).FindControl("txtRazonSocial")).Enabled = false;
            }

            /*Esto agregue*/
            this.RegistrarHabilitarZonas();
            this.chkZona.Attributes.Add("onclick", "HabilitarZonas();");
            ScriptMostrar();
            RegistrarLimpiarAgencia();
            RegistrarLimpiarVendedor();
            RegistrarLimpiarCliente();
            RegistrarLimpiarAgrupacionCliente();
            this.rbtAgencias.Attributes.Add("onclick", "mostrar();LimpiarAgencia();document.getElementById('tblEstadoCartera').style.display = 'none';");
            this.rbtVendedores.Attributes.Add("onclick", "mostrar();LimpiarVendedor();document.getElementById('tblEstadoCartera').style.display = 'none';");
            this.rbtClientes.Attributes.Add("onclick", "mostrar();LimpiarCliente();document.getElementById('tblEstadoCartera').style.display = 'inline';");
            this.rbtAgrupacionCliente.Attributes.Add("onclick", "mostrar();LimpiarAgrupacionCliente();document.getElementById('tblEstadoCartera').style.display = 'none';");

            /* Esto estaba
             * else
             * {
             * this.rbtAgencias.Attributes.Add("onclick","mostrar();LimpiarAgencia();document.getElementById('tblEstadoCartera').style.display = 'none';");
             * this.rbtVendedores.Attributes.Add("onclick","mostrar();LimpiarVendedor();document.getElementById('tblEstadoCartera').style.display = 'none';");
             * this.rbtClientes.Attributes.Add("onclick","mostrar();LimpiarCliente();document.getElementById('tblEstadoCartera').style.display = 'inline';");
             * }*/
        }
コード例 #26
0
        private void dtgAgencias_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                int indice = e.Item.DataSetIndex;
                BindGrid();

                DsAgencias.DatosRow[] drLista = (DsAgencias.DatosRow[])dtgAgencias.DataSource;
                if (drLista == null)
                {
                    return;
                }

                if (drLista.Length == 0)
                {
                    return;
                }

                DsAgencias.DatosRow dr = drLista[indice];
                if (dr == null)
                {
                    return;
                }

                int    agenciaID   = dr.AgenciaID;
                string sucursal    = dr.SucursalDGI;
                string razonSocial = dr.RazonSocial;


                StringBuilder scriptString = new StringBuilder();
                scriptString.Append("<script language='javascript'>\n");
                //MODIFICACION PAR CHROME. FLORENCIA QUIROGA. 01/07/2014
                scriptString.Append("select(" + sucursal + "," + "'" + razonSocial + "'" + "," + "'" + agenciaID + "'" + "," + "'" + parametro + "'" + " );");
                scriptString.Append("window.close();\n");
                scriptString.Append("</script>");
                //chrome parent.
                Page.RegisterClientScriptBlock("scriptModalAgencia", scriptString.ToString());
                scriptString.Append("</script>");
                //chrome parent.
                Page.RegisterClientScriptBlock("scriptModalAgencia", scriptString.ToString());
            }
            if (e.CommandName == "SelectVendedor")
            {
                int indice = e.Item.DataSetIndex;
                BindGrid();

                DsAgencias.DatosRow[] drLista = (DsAgencias.DatosRow[])dtgAgencias.DataSource;
                if (drLista == null)
                {
                    return;
                }

                if (drLista.Length == 0)
                {
                    return;
                }

                DsAgencias.DatosRow dr = drLista[indice];
                if (dr == null)
                {
                    return;
                }

                int agenciaID = dr.AgenciaID;
                //string sucursal = dr.SucursalDGI;
                //string razonSocial = dr.RazonSocial;
                IAgencia agencia = AgenciaFactory.GetAgencia();
                agencia.AgenciaID = agenciaID;
                agencia.Consultar();
                Session["Vendedor"] = null;

                IVendedor vend = VendedorFactory.GetVendedor();
                vend.NroLegajo             = "v" + dr.SucursalDGI;
                vend.Nombre                = dr.Nombre;
                vend.AgenciaID             = agenciaID;
                vend.Apellido              = dr.Nombre;
                vend.Domicilio.DomicilioID = dr.DomicilioID;
                vend.Domicilio.DomicilioID = agencia.Domicilio.DomicilioID;
                vend.Domicilio.Calle       = agencia.Domicilio.Calle;
                vend.Domicilio.CalleNro    = agencia.Domicilio.CalleNro;
                vend.Domicilio.Telefono    = agencia.Domicilio.Telefono;
                vend.Domicilio.Localidad.Provincia.ProvinciaID = agencia.Domicilio.Localidad.Provincia.ProvinciaID;
                vend.Domicilio.Localidad.LocalidadID           = agencia.Domicilio.Localidad.LocalidadID;
                vend.Domicilio.Fax   = agencia.Domicilio.Fax;
                vend.Domicilio.Depto = agencia.Domicilio.Depto;
                Session["Vendedor"]  = (IVendedor)vend;

                StringBuilder scriptString = new StringBuilder();
                scriptString.Append("<script language='javascript'>\n");
                //MODIFICACION PARA CHROME. FLORENCIA QUIROGA.01/07/2014.

                //scriptString.Append("window.returnValue = true;\n");
                //scriptString.Append("window.close();\n");
                scriptString.Append("parent.window.returnValue = true;\n");
                scriptString.Append("parent.window.close();\n");
                scriptString.Append("</script>");
                Page.RegisterClientScriptBlock("scrptVendedor", scriptString.ToString());
            }
        }
コード例 #27
0
        private void Buscar()
        {
            int total = 0;

            try
            {
                IVendedor    vendedor = VendedorFactory.GetVendedor();
                DsVendedores ds       = vendedor.GetVendedoresDataSet();

                string filtro = null;
                if (this.codigo != "")
                {
                    filtro = "NroLegajo LIKE '" + codigo + "%' AND (Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%')";
                }
                else
                {
                    filtro = "(Apellido LIKE '" + this.apellidoNombre + "%' OR Nombre LIKE '" + this.apellidoNombre + "%')";
                }

                if (this.TxtEmpActual.Text != "")
                {
                    filtro += " AND VendedorID <> " + this.TxtEmpActual.Text;
                }

                //DEBE TENER EL ATRIBUTO DE SUPERVISOR EN "SI", siempre que sea llamado desde los vendedores
                if (this.txtFiltro.Text == "")
                {
                    filtro += " AND EsSupervisor=true";
                }

                DsVendedores.DatosRow[] drLista = (DsVendedores.DatosRow[])ds.Datos.Select(filtro);
                total = drLista.Length;

                if (total > 0)
                {
                    if (total == 1)
                    {
                        DsVendedores.DatosRow dr = drLista[0];

                        this.txtVendedorID.Text     = dr.VendedorID.ToString();
                        this.txtCodigo.Text         = dr.IsNroLegajoNull() ? null : dr.NroLegajo;
                        this.txtApellidoNombre.Text = dr.Apellido + " " + dr.Nombre;
                        this.txtErrorMsg.Text       = "";
                        this.txtOpen.Text           = "";
                    }
                    else
                    {
                        this.txtCodigo.Text         = this.codigo;
                        this.txtApellidoNombre.Text = this.apellidoNombre;
                        this.txtOpen.Text           = "S";
                    }
                }
                else
                {
                    this.txtVendedorID.Text = "";
                    this.txtErrorMsg.Text   = "No se encontraron datos.";
                    this.txtOpen.Text       = "";
                }
            }
            catch (Exception ex)
            {
                this.txtErrorMsg.Text = "Error al consultar datos de supervisores: " + ex.Message;
            }
        }