Exemplo n.º 1
0
        private void BindGrid(int currentPage)
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgPuntosRecepcion, "PuntoRecepcionID", this.CantidadOpciones);
            IPuntoRecepcion oPunto           = PuntoRecepcionFactory.GetPuntoRecepcion();
            string          razonSocial      = this.txtRazonSocial.Text;
            string          provinciaDescrip = this.txtProvincia.Text;
            string          sucursalDGI      = this.txtSucursalDGI.Text;
            //dtgAgencias.DataSource = oAgencia.GetAgenciasConsultaDataSet();
            DsPuntosRecepcion ds = oPunto.GetPuntosRecepcionDataSet();

            //dtgAgencias.DataSource= ds.Datos.Select("UnidadNegocioID = " + this.UnidadNegocioID + " AND RazonSocial LIKE '" + razonSocial + "%' AND ProvinciaDescrip LIKE '%" + provinciaDescrip + "%'","RazonSocial");

            this.dtgPuntosRecepcion.DataSource  = (DsPuntosRecepcion.DatosRow[])ds.Datos.Select("Codigo LIKE '" + sucursalDGI + "%' AND RazonSocial LIKE '" + this.txtRazonSocial.Text + "%'" + " AND ProvinciaDescrip LIKE '" + this.txtProvincia.Text + "%'", "RazonSocial");
            dtgPuntosRecepcion.CurrentPageIndex = currentPage;
            dtgPuntosRecepcion.DataBind();
        }
        private void BindGridPuntosRecepcionCL()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgPuntosRecepcion, "PuntoRecepcionID", this.CantidadOpciones);
            try
            {
                IPuntoRecepcion   puntoRecepcion = PuntoRecepcionFactory.GetPuntoRecepcion();
                DsPuntosRecepcion ds             = null;

                ds = puntoRecepcion.GetPuntosRecepcionDataSet();

                string sucursal = this.txtSucursal.Text;
                string razon    = this.txtRazonSocial.Text;
                string filtro   = "Codigo LIKE '" + sucursal + "%' AND RazonSocial LIKE '" + razon + "%'";

                DsPuntosRecepcion.DatosRow[] drPuntoRecepcion = (DsPuntosRecepcion.DatosRow[])ds.Datos.Select(filtro);

                dtgPuntosRecepcion.DataSource = drPuntoRecepcion;
                dtgPuntosRecepcion.DataBind();

                if (Session["dsPuntosRecepcionCL"] != null)
                {
                    DsPuntosRecepcion dsPuntosRecepcion = (DsPuntosRecepcion)Session["dsPuntosRecepcionCL"];
                    foreach (DataGridItem item in this.dtgPuntosRecepcion.Items)
                    {
                        if (dsPuntosRecepcion.Datos.Select("PuntoRecepcionID = " + Convert.ToInt32(item.Cells[0].Text.Trim())).Length > 0)
                        {
                            ((CheckBox)this.dtgPuntosRecepcion.Items[item.ItemIndex].Cells[3].FindControl("ckSeleccionarP")).Checked = true;
                        }
                    }
                    dsPuntosRecepcion = null;
                }

                ds             = null;
                puntoRecepcion = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void BindGridPuntosRecepcion()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgPuntosRecepcion, "PuntoRecepcionID", this.CantidadOpciones);
            try
            {
                IPuntoRecepcion   puntoRecepcion = PuntoRecepcionFactory.GetPuntoRecepcion();
                DsPuntosRecepcion ds             = null;

                ds = puntoRecepcion.GetPuntosRecepcionDataSet();

                string sucursal       = this.txtSucursal.Text;
                string razon          = this.txtRazonSocial.Text;
                string filtroEspecial = this.txtFiltro.Text;
                string agenciaActual  = this.txtAgenciaActual.Text;
                string filtro         = "Codigo LIKE '" + sucursal + "%' AND RazonSocial LIKE '" + razon + "%'";

                //Agregar que si no le paso una agencia actual, no la tenga que buscar.

/*				if (filtroEspecial ==NegociosSisPackInterface.SisPack.TipoAgencia.Cabecera.ToString())
 *                              {
 *                                      if(agenciaActual != null && agenciaActual.Length > 0)
 *                                              filtro += " AND EsCabecera = true AND AgenciaID <> " + agenciaActual;
 *                                      else
 *                                              filtro += " AND EsCabecera = true" ;
 *                              }
 *                              else if (filtroEspecial ==NegociosSisPackInterface.SisPack.TipoAgencia.Madre.ToString())
 *                                      filtro += " AND (AgenciaMadre IS NULL OR AgenciaMadre <> " + agenciaActual + " ) AND AgenciaID <> " + agenciaActual;
 */

                DsPuntosRecepcion.DatosRow[] drPuntoRecepcion = (DsPuntosRecepcion.DatosRow[])ds.Datos.Select(filtro);

                dtgPuntosRecepcion.DataSource = drPuntoRecepcion;
                dtgPuntosRecepcion.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
                //this.txtErrorMsg.Text = "Error al consultar datos de agencias: " + ex.Message;
            }
        }
        private void Buscar()
        {
            int total = 0;

            try
            {
                if (parametro != "3")               //si no se un punto de recepción
                {
                    #region Agencia
                    IAgencia   agencia = AgenciaFactory.GetAgencia();
                    DsAgencias ds      = agencia.GetAgenciasDataSet();

                    string filtro = "SucursalDGI LIKE '" + this.sucursal + "%' AND RazonSocial LIKE '" + this.razonSocial + "%'";
                    //Agregar que si no le paso una agencia actual, no la tenga que buscar.
                    if (this.filtroEspecial == NegociosSisPackInterface.SisPack.TipoAgencia.Cabecera.ToString())
                    {
                        if (this.agenciaActual != null && this.agenciaActual.Length > 0)
                        {
                            filtro += " AND EsCabecera = true AND AgenciaID <> " + this.agenciaActual;
                        }
                        else
                        {
                            filtro += " AND EsCabecera = true";
                        }
                    }
                    else if (this.filtroEspecial == NegociosSisPackInterface.SisPack.TipoAgencia.Madre.ToString())
                    {
                        filtro += " AND (AgenciaMadre IS NULL OR AgenciaMadre <> " + this.agenciaActual + " ) AND AgenciaID <> " + this.agenciaActual;
                    }

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

                    if (total > 0)
                    {
                        if (total == 1)
                        {
                            DsAgencias.DatosRow dr = drLista[0];
                            this.txtAgenciaID.Text   = dr.AgenciaID.ToString();
                            this.txtSucursal.Text    = dr.SucursalDGI;
                            this.txtRazonSocial.Text = dr.RazonSocial;
                            this.txtErrorMsg.Text    = "";
                            this.txtOpen.Text        = "";
                        }
                        else
                        {
                            this.txtSucursal.Text      = this.sucursal;
                            this.txtRazonSocial.Text   = this.razonSocial;
                            this.txtOpen.Text          = "S";
                            this.txtFiltro.Text        = this.filtroEspecial;
                            this.txtAgenciaActual.Text = this.agenciaActual;
                        }
                        this.txtParametro.Text = this.parametro;
                    }
                    else
                    {
                        this.txtAgenciaID.Text = "";
                        this.txtErrorMsg.Text  = "No se encontraron datos.";
                        this.txtOpen.Text      = "";
                    }
                    #endregion
                }
                else
                {
                    #region PuntoRecepcion
                    IPuntoRecepcion   puntoRecepcion = PuntoRecepcionFactory.GetPuntoRecepcion();
                    DsPuntosRecepcion ds             = null;
                    ds = puntoRecepcion.GetPuntosRecepcionDataSet();

                    string sucursal       = this.txtSucursal.Text;
                    string razon          = this.txtRazonSocial.Text;
                    string filtroEspecial = this.txtFiltro.Text;
                    string agenciaActual  = this.txtAgenciaActual.Text;
                    string filtro         = "Codigo LIKE '" + sucursal + "%' AND RazonSocial LIKE '" + razon + "%'";
                    DsPuntosRecepcion.DatosRow[] drPuntoRecepcion = (DsPuntosRecepcion.DatosRow[])ds.Datos.Select(filtro);
                    total = drPuntoRecepcion.Length;
                    if (total > 0)
                    {
                        if (total == 1)
                        {
                            this.txtAgenciaID.Text   = drPuntoRecepcion[0].PuntoRecepcionID.ToString();
                            this.txtSucursal.Text    = drPuntoRecepcion[0].Codigo;
                            this.txtRazonSocial.Text = drPuntoRecepcion[0].RazonSocial;
                            this.txtErrorMsg.Text    = "";
                            this.txtOpen.Text        = "";
                        }
                        else
                        {
                            this.txtSucursal.Text      = this.sucursal;
                            this.txtRazonSocial.Text   = this.razonSocial;
                            this.txtOpen.Text          = "S";
                            this.txtFiltro.Text        = this.filtroEspecial;
                            this.txtAgenciaActual.Text = this.agenciaActual;
                        }
                        this.txtParametro.Text = this.parametro;
                    }
                    else
                    {
                        this.txtAgenciaID.Text = "";
                        this.txtErrorMsg.Text  = "No se encontraron datos.";
                        this.txtOpen.Text      = "";
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                this.txtErrorMsg.Text = "Error al consultar datos de agencias: " + ex.Message;
            }
        }