Exemple #1
0
        public DsPromocionOrigenDestinoUVenta GetPromocionesByUnidadVenta()
        {
            DsPromocionOrigenDestinoUVenta ds = new DsPromocionOrigenDestinoUVenta();

            SqlParameter pUnidadVenta = new SqlParameter("@UnidadVentaID", this.UnidadVentaID);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaByUVenta", pUnidadVenta);

            return(ds);
        }
Exemple #2
0
        public DsPromocionOrigenDestinoUVenta GetPromocionesZonasOrigenALL()
        {
            DsPromocionOrigenDestinoUVenta ds = new DsPromocionOrigenDestinoUVenta();
            SqlParameter pUnidadNegocioID     = new SqlParameter("@UnidadNegocioID", this.UnidadNegocioID);
            SqlParameter pDescripcion         = new SqlParameter("@Descripcion", this.PromocionOrigenDestinoUVentaDescrip);
            SqlParameter pFechaDesde          = new SqlParameter("@FechaDesde", this.FechaInicio);
            SqlParameter pFechaHasta          = new SqlParameter("@FechaHasta", this.FechaFin);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaZonaOrigenALL", pUnidadNegocioID, pDescripcion, pFechaDesde, pFechaHasta);
            return(ds);
        }
Exemple #3
0
        public bool Consultar()
        {
            DsPromocionOrigenDestinoUVenta ds = this.GetPromocionByPromocionID();

            DsPromocionOrigenDestinoUVenta.DatosRow dr = (DsPromocionOrigenDestinoUVenta.DatosRow)ds.Datos.Rows[0];

            DsPromocionSispWeb sw = this.GetPromocionesSispackWebSEL(dr.PromocionSispackWebID);

            if (ds == null && sw == null)
            {
                return(false);
            }

            this.PromocionOrigenDestinoUVentaDescrip = dr.PromocionOrigenDestinoUVentaDescrip;
            this.PromocionOrigenDestinoUVentaDescrip = dr.PromocionOrigenDestinoUVentaDescrip;
            this.UnidadVentaID      = dr.UnidadVentaID;
            this.OrigenFleteID      = dr.IsOrigenFleteIDNull() ? 0 : dr.OrigenFleteID;
            this.DestinoFleteID     = dr.IsDestinoFleteIDNull() ? 0 : dr.DestinoFleteID;
            this.TipoOrigenFleteID  = dr.IsTipoOrigenIDNull() ? 0 : dr.TipoOrigenID;
            this.TipoDestinoFleteID = dr.IsTipoDestinoIDNull() ? 0 : dr.TipoDestinoID;
            this.ZonaOrigenID       = dr.IsZonaOrigenIDNull() ? 0 : dr.ZonaOrigenID;
            this.zonaDestinoID      = dr.IsZonaDestinoIDNull() ? 0 : dr.ZonaDestinoID;
            this.FechaInicio        = dr.FechaInicio;
            this.FechaFin           = dr.IsFechaFinNull() ? new DateTime(1900, 1, 1) : dr.FechaFin;
            this.IncrementoBonificacionImporteFijo = dr.IsIncrementoBonificacionImporteFijoNull() ? 0 : dr.IncrementoBonificacionImporteFijo;
            this.IncrementoBonificacionPorcentaje  = dr.IsIncrementoBonificacionPorcentajeNull() ? 0 : dr.IncrementoBonificacionPorcentaje;
            this.UnidadNegocioID = dr.IsUnidadNegocioIDNull() ? 0 : dr.UnidadNegocioID;

            DsPromocionSispWeb.DatosRow drSW = (DsPromocionSispWeb.DatosRow)sw.Datos.Rows[0];

            this.Sispack = drSW.Sispack;
            this.Web     = drSW.Web;
            this.Flete   = drSW.Flete;
            this.Retiro  = drSW.Retiro;
            this.Entrega = drSW.Entrega;
            this.Codigo  = drSW.Codigo;
            return(true);
        }
Exemple #4
0
        public DsPromocionOrigenDestinoUVenta GetPromocionByPromocionID()
        {
            DsPromocionOrigenDestinoUVenta ds = new DsPromocionOrigenDestinoUVenta();
            SqlParameter pUnidadNegocioID     = new SqlParameter("@UnidadNegocioID", this.UnidadNegocioID);
            SqlParameter pPromocionID         = new SqlParameter("@PromocionOrigenDestinoUVentaID", this.PromocionOrigenDestinoUVentaID);

            //llamo
            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaSEL", pUnidadNegocioID, pPromocionID);
            //si esta vacio, llamo al siguiente
            if (ds.Datos.Count == 0)
            {
                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaZonasSEL", pUnidadNegocioID, pPromocionID);
            }
            if (ds.Datos.Count == 0)
            {
                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaZonaDestinoSEL", pUnidadNegocioID, pPromocionID);
            }
            if (ds.Datos.Count == 0)
            {
                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PromocionOrigenDestinoUVentaZonaOrigenSEL", pUnidadNegocioID, pPromocionID);
            }

            return(ds);
        }
Exemple #5
0
        private void BindGrid(bool configurarExportarExcel)
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgPromociones, "PromocionOrigenDestinoUVentaID", this.CantidadOpciones);

            if (configurarExportarExcel)
            {
                // Tengo que configurar para exportar a excel
                dtgPromociones.AllowPaging = false;
                //dtgObservacion.Columns[1].Visible = false;
                // dtgObservacion.BorderWidth = Unit.Pixel(0);
                dtgPromociones.BorderColor = System.Drawing.Color.White;
                dtgPromociones.BorderStyle = BorderStyle.None;
            }

            IPromocionOrigenDestinoUVenta promocion = PromocionOrigenDestinoUVentaFactory.GetPromocionOrigenDestinoUVenta();

            //filtros
            promocion.PromocionOrigenDestinoUVentaDescrip = this.txtDescripcionPromocion.Text;
            promocion.UnidadNegocioID = this.UnidadNegocioID;

            string desde = this.txtFechaInicioDesde.Text == "" ? "01/01/1900" : this.txtFechaInicioDesde.Text;
            //string hasta = this.txtFechaInicioHasta.Text == "" ? DateTime.Now.ToString("dd/MM/yyyy") : this.txtFechaInicioHasta.Text;
            //T.Laz 10-05-18
            string hasta = this.txtFechaInicioHasta.Text == "" ? "01/01/2100" : this.txtFechaInicioHasta.Text;

            DateTime desdeDateTime = DateTime.ParseExact(desde, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime hastaDateTime = DateTime.ParseExact(hasta, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            //T.Laz 10-05-18
            hastaDateTime.AddDays(1);

            promocion.FechaInicio = desdeDateTime;
            promocion.FechaFin    = hastaDateTime;
            promocion.Web         = Convert.ToInt32(ddlWeb.SelectedValue);
            //1º obtengo todas las promociones con origenes y destinos que no son zonas
            DsPromocionOrigenDestinoUVenta ds    = promocion.GetPromocionesALL();
            DsPromocionOrigenDestinoUVenta dsAux = new DsPromocionOrigenDestinoUVenta();

            //2º obtengo todas las promociones con origenes y destino que sí son zonas, y los pongo en un ds auxiliar
            if (ddlWeb.SelectedValue == "2")
            {
                dsAux = promocion.GetPromocionesZonasALL();

                //cargo el contenido del aux en el ds final
                foreach (DsPromocionOrigenDestinoUVenta.DatosRow row in dsAux.Tables[0].Rows)
                {
                    ds.Datos.AddDatosRow(row.PromocionOrigenDestinoUVentaID,
                                         row.UnidadVentaID,
                                         row.FechaInicio,
                                         row.IsFechaFinNull() ? new DateTime() : row.FechaFin,
                                         row.PromocionOrigenDestinoUVentaDescrip,
                                         row.IsIncrementoBonificacionPorcentajeNull() ? 0 : row.IncrementoBonificacionPorcentaje,
                                         row.IsIncrementoBonificacionImporteFijoNull() ? 0 : row.IncrementoBonificacionImporteFijo,
                                         row.IsUnidadNegocioIDNull() ? 0 : row.UnidadNegocioID,
                                         row.IsBajaNull() ? false : row.Baja,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsOrigenDescripNull() ? "" : row.OrigenDescrip,
                                         row.IsTipoOrigenDescripNull() ? "" : row.TipoOrigenDescrip,
                                         row.IsDestinoDescripNull() ? "" : row.DestinoDescrip,
                                         row.IsTipoDestinoDescripNull() ? "" : row.TipoDestinoDescrip,
                                         row.UnidadVentaDescrip,
                                         row.IsTipoOrigenIDNull() ? 0 : row.TipoOrigenID,
                                         row.IsTipoDestinoIDNull() ? 0 : row.TipoDestinoID,
                                         row.IsZonaOrigenIDNull() ? 0 : row.ZonaOrigenID,
                                         row.IsZonaDestinoIDNull() ? 0 : row.ZonaDestinoID,
                                         row.IsZonaOrigenDescripNull() ? "" : row.ZonaOrigenDescrip,
                                         row.IsZonaDestinoDescripNull() ? "" : row.ZonaDestinoDescrip,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsPromocionSispackWebIDNull() ? 0 : row.PromocionSispackWebID,
                                         row.SispackDescrip,
                                         row.WebDescrip
                                         );
                    //ds.Datos.AddDatosRow(row);
                }
            }
            //3º obtengo todas las promociones con origenes zonas y destino no zonas y los pongo en un ds auxiliar
            if (ddlWeb.SelectedValue == "2")
            {
                dsAux = promocion.GetPromocionesZonasOrigenALL();

                //cargo el contenido del aux en el ds final
                foreach (DsPromocionOrigenDestinoUVenta.DatosRow row in dsAux.Tables[0].Rows)
                {
                    ds.Datos.AddDatosRow(row.PromocionOrigenDestinoUVentaID,
                                         row.UnidadVentaID,
                                         row.FechaInicio,
                                         row.IsFechaFinNull() ? new DateTime() : row.FechaFin,
                                         row.PromocionOrigenDestinoUVentaDescrip,
                                         row.IsIncrementoBonificacionPorcentajeNull() ? 0 : row.IncrementoBonificacionPorcentaje,
                                         row.IsIncrementoBonificacionImporteFijoNull() ? 0 : row.IncrementoBonificacionImporteFijo,
                                         row.IsUnidadNegocioIDNull() ? 0 : row.UnidadNegocioID,
                                         row.IsBajaNull() ? false : row.Baja,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsOrigenDescripNull() ? "" : row.OrigenDescrip,
                                         row.IsTipoOrigenDescripNull() ? "" : row.TipoOrigenDescrip,
                                         row.IsDestinoDescripNull() ? "" : row.DestinoDescrip,
                                         row.IsTipoDestinoDescripNull() ? "" : row.TipoDestinoDescrip,
                                         row.UnidadVentaDescrip,
                                         row.IsTipoOrigenIDNull() ? 0 : row.TipoOrigenID,
                                         row.IsTipoDestinoIDNull() ? 0 : row.TipoDestinoID,
                                         row.IsZonaOrigenIDNull() ? 0 : row.ZonaOrigenID,
                                         row.IsZonaDestinoIDNull() ? 0 : row.ZonaDestinoID,
                                         row.IsZonaOrigenDescripNull() ? "" : row.ZonaOrigenDescrip,
                                         row.IsZonaDestinoDescripNull() ? "" : row.ZonaDestinoDescrip,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsPromocionSispackWebIDNull() ? 0 : row.PromocionSispackWebID,
                                         row.SispackDescrip,
                                         row.WebDescrip
                                         );
                }
            }
            //4º obtengo todas las promociones con origenes no zonas y destinos zonas y los pongo en un ds auxiliar
            if (ddlWeb.SelectedValue == "2")
            {
                dsAux = promocion.GetPromocionesZonasDestinoALL();

                //cargo el contenido del aux en el ds final
                foreach (DsPromocionOrigenDestinoUVenta.DatosRow row in dsAux.Tables[0].Rows)
                {
                    ds.Datos.AddDatosRow(row.PromocionOrigenDestinoUVentaID,
                                         row.UnidadVentaID,
                                         row.FechaInicio,
                                         row.IsFechaFinNull() ? new DateTime() : row.FechaFin,
                                         row.PromocionOrigenDestinoUVentaDescrip,
                                         row.IsIncrementoBonificacionPorcentajeNull() ? 0 : row.IncrementoBonificacionPorcentaje,
                                         row.IsIncrementoBonificacionImporteFijoNull() ? 0 : row.IncrementoBonificacionImporteFijo,
                                         row.IsUnidadNegocioIDNull() ? 0 : row.UnidadNegocioID,
                                         row.IsBajaNull() ? false : row.Baja,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsOrigenDescripNull() ? "" : row.OrigenDescrip,
                                         row.IsTipoOrigenDescripNull() ? "" : row.TipoOrigenDescrip,
                                         row.IsDestinoDescripNull() ? "" : row.DestinoDescrip,
                                         row.IsTipoDestinoDescripNull() ? "" : row.TipoDestinoDescrip,
                                         row.UnidadVentaDescrip,
                                         row.IsTipoOrigenIDNull() ? 0 : row.TipoOrigenID,
                                         row.IsTipoDestinoIDNull() ? 0 : row.TipoDestinoID,
                                         row.IsZonaOrigenIDNull() ? 0 : row.ZonaOrigenID,
                                         row.IsZonaDestinoIDNull() ? 0 : row.ZonaDestinoID,
                                         row.IsZonaOrigenDescripNull() ? "" : row.ZonaOrigenDescrip,
                                         row.IsZonaDestinoDescripNull() ? "" : row.ZonaDestinoDescrip,
                                         row.IsDestinoFleteIDNull() ? 0 : row.DestinoFleteID,
                                         row.IsOrigenFleteIDNull() ? 0 : row.OrigenFleteID,
                                         row.IsPromocionSispackWebIDNull() ? 0 : row.PromocionSispackWebID,
                                         row.SispackDescrip,
                                         row.WebDescrip
                                         );
                }
            }
            this.Session["dtgPromociones"]       = ds;
            this.dtgPromociones.DataSource       = ds;
            this.dtgPromociones.CurrentPageIndex = 0;
            this.dtgPromociones.DataBind();
        }