Beispiel #1
0
        public DsPlanillaHojaRuta GetHojasRutaConfirmadasServicios()
        {
            DsPlanillaHojaRuta ds = new DsPlanillaHojaRuta();
            SqlParameter       pServicioTransporteIdaID    = new SqlParameter("@ServicioTransporteIdaID", this.ServicioTransporteIdaID);
            SqlParameter       pServicioTransporteVueltaID = new SqlParameter("@ServicioTransporteVueltaID", this.ServicioTransporteVueltaID);

            Config.Conexion.LlenarTypeDataSet(ds.DatosDetalle, System.Data.CommandType.StoredProcedure, "HojasRutaConfirmadasSEL", pServicioTransporteIdaID, pServicioTransporteVueltaID);
            return(ds);
        }
Beispiel #2
0
        public DsPlanillaHojaRuta GetPlanillaHojaRutaDetalleDataSet(bool automatizadas)
        {
            DsPlanillaHojaRuta ds = new DsPlanillaHojaRuta();
            SqlParameter       pPlanillaHojaRutaID = new SqlParameter("@PlanillaHojaRutaID", this.PlanillaHojaRutaID);
            SqlParameter       pAutomatizadas      = new SqlParameter("@Automatizadas", automatizadas);

            Config.Conexion.LlenarTypeDataSet(ds.DatosDetalle, System.Data.CommandType.StoredProcedure, "PlanillasHojasRutaDetalleSEL", pPlanillaHojaRutaID, pAutomatizadas);
            return(ds);
        }
Beispiel #3
0
        public DsPlanillaHojaRuta GetPlanillasHojaRutaDataSet()
        {
            DsPlanillaHojaRuta ds           = new DsPlanillaHojaRuta();
            SqlParameter       pNroPlanilla = new SqlParameter("@NroPlanilla", Utiles.BaseDatos.IntToSql(this.NroPlanilla));
            SqlParameter       pFecha       = new SqlParameter("@Fecha", Utiles.BaseDatos.FechaToSql(this.Fecha));

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "PlanillasHojasRutaSEL", pNroPlanilla, pFecha);
            return(ds);
        }
        private void BindGridManualConsulta()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgHojasRutaManuales, "HojaRutaID", this.CantidadOpciones);
            IPlanillaHojaRuta planillaHojaRuta = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();

            planillaHojaRuta.PlanillaHojaRutaID = Convert.ToInt32(this.txtPlanillaHojaRutaID.Text);
            DsPlanillaHojaRuta ds = planillaHojaRuta.GetPlanillaHojaRutaDetalleDataSet(false);

            dtgHojasRutaManuales.DataSource = ds.DatosDetalle;
            dtgHojasRutaManuales.DataBind();
        }
        private void BindGridAutomatizadasConsulta()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgHojasRutaAutomatizadas, "HojaRutaID", this.CantidadOpciones);
            IPlanillaHojaRuta planillaHojaRuta = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();

            planillaHojaRuta.PlanillaHojaRutaID = Convert.ToInt32(this.txtPlanillaHojaRutaID.Text);
            DsPlanillaHojaRuta ds = planillaHojaRuta.GetPlanillaHojaRutaDetalleDataSet(true);

            dtgHojasRutaAutomatizadas.DataSource         = ds.DatosDetalle;
            dtgHojasRutaAutomatizadas.Columns[0].Visible = false;
            //dtgHojasRutaAutomatizadas.Columns[3].Visible = false;
            dtgHojasRutaAutomatizadas.DataBind();
        }
        private void BindGridAutomatizadas()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgHojasRutaAutomatizadas, "HojaRutaID", this.CantidadOpciones);
            IPlanillaHojaRuta planillaHojaRuta = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();

            planillaHojaRuta.ServicioTransporteIdaID    = Convert.ToInt32(this.ddlServiciosIda.SelectedValue);
            planillaHojaRuta.ServicioTransporteVueltaID = Convert.ToInt32(this.ddlServiciosVuelta.SelectedValue);
            DsPlanillaHojaRuta ds = planillaHojaRuta.GetHojasRutaConfirmadasServicios();

            Session["HojasRutasAutomatizadas"]   = ds;
            dtgHojasRutaAutomatizadas.DataSource = ds.DatosDetalle;
            //dtgHojasRutaAutomatizadas.CurrentPageIndex = 0;
            dtgHojasRutaAutomatizadas.DataBind();
        }
Beispiel #7
0
        private void BindGrid()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgPlanillas, "PlanillaHojaRutaID", this.CantidadOpciones);
            this.dtgPlanillas.AllowPaging = false;
            IPlanillaHojaRuta planilla = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();

            planilla.NroPlanilla = this.txtNroPlanilla.Text == "" ? 0 : Convert.ToInt32(this.txtNroPlanilla.Text);
            planilla.Fecha       = this.txtFecha.Text == "" ? new DateTime(1900, 1, 1) : Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFecha.Text);
            DsPlanillaHojaRuta ds = planilla.GetPlanillasHojaRutaDataSet();

            Session["dsPlanillas"]             = ds;
            this.dtgPlanillas.DataSource       = ds;
            this.dtgPlanillas.CurrentPageIndex = 0;
            this.dtgPlanillas.DataBind();
        }
        private void butGuardar_Click(object sender, System.EventArgs e)
        {
            try
            {
                bool tieneAutomatizadas = false;
                DsPlanillaHojaRuta dsAutomatizadasAux = (DsPlanillaHojaRuta)Session["HojasRutasAutomatizadas"];
                DsPlanillaHojaRuta dsAutomatizadas    = new DsPlanillaHojaRuta();

                foreach (DataGridItem item in dtgHojasRutaAutomatizadas.Items)
                {
                    if (((CheckBox)item.FindControl("chkSeleccion")).Checked)
                    {
                        DsPlanillaHojaRuta.DatosDetalleRow[] dr = (DsPlanillaHojaRuta.DatosDetalleRow[])dsAutomatizadasAux.DatosDetalle.Select("HojaRutaID=" + Convert.ToString(dtgHojasRutaAutomatizadas.DataKeys[item.DataSetIndex]));
                        dr[0].NroCarpeta = (((TextBox)item.FindControl("txtNroCarpeta")).Text == "") ? 0 : Convert.ToInt32(((TextBox)item.FindControl("txtNroCarpeta")).Text);
                        dsAutomatizadas.DatosDetalle.ImportRow(dr[0]);
                        tieneAutomatizadas = true;
                    }
                }

                if (Session["HojasRutaManuales"] == null)
                {
                    if (!tieneAutomatizadas)
                    {
                        throw new Exception("La planilla no contiene hojas de rutas automatizadas ni manuales.");
                    }
                    else
                    {
                        Session["HojasRutaManuales"] = new DsPlanillaHojaRuta();
                    }
                }
                DsPlanillaHojaRuta dsManuales = (DsPlanillaHojaRuta)Session["HojasRutaManuales"];

                IPlanillaHojaRuta planilla = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();
                planilla.NroPlanilla                = Convert.ToInt32(this.txtNroPlanillaHojaRuta.Text);
                planilla.ServicioTransporteIdaID    = Convert.ToInt32(this.ddlServiciosIda.SelectedValue);
                planilla.ServicioTransporteVueltaID = Convert.ToInt32(this.ddlServiciosVuelta.SelectedValue);
                if (planilla.Guardar(dsAutomatizadas, dsManuales))
                {
                    Session["HojasRutaManuales"] = null;
                    Response.Redirect("PlanillaHojaRuta.aspx");
                }
            }
            catch (Exception ex)
            {
                this.ManejaErrores(ex);
            }
        }
        private void butAgregar_Click(object sender, System.EventArgs e)
        {
            RequiredFieldValidator reqNroSucursal = (RequiredFieldValidator)this.phValidNroSucursalHRManual.FindControl("reqNroSucursal");

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

            BaseValidator validNroSucursal = (BaseValidator)this.phValidNroSucursalHRManual.FindControl("validNroSucursal");

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

            RequiredFieldValidator reqNroHojaRuta = (RequiredFieldValidator)this.phValidNroHojaRutaManual.FindControl("reqNroHojaRuta");

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

            BaseValidator validNroHojaRuta = (BaseValidator)this.phValidNroHojaRutaManual.FindControl("validNroHojaRuta");

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

            /*RequiredFieldValidator reqNroCarpeta = (RequiredFieldValidator)this.phValidNroCarpetaManual.FindControl("reqNroCarpeta");
             * reqNroCarpeta.Enabled = true;
             * reqNroCarpeta.Validate();
             * if(!reqNroCarpeta.IsValid)
             *      return;
             *
             * BaseValidator validNroCarpeta = (BaseValidator) this.phValidNroCarpetaManual.FindControl("validNroCarpeta");
             * validNroCarpeta.Enabled = true;
             * validNroCarpeta.Validate();
             * if(!validNroCarpeta.IsValid)
             *      return;*/

            SisPackController.AdministrarGrillas.Configurar(this.dtgHojasRutaManuales, "HojaRutaID", this.CantidadOpciones);

            DsPlanillaHojaRuta ds = new DsPlanillaHojaRuta();

            if (Session["HojasRutaManuales"] != null)
            {
                ds = (DsPlanillaHojaRuta)Session["HojasRutaManuales"];
            }

            DsPlanillaHojaRuta.DatosDetalleRow dr = (DsPlanillaHojaRuta.DatosDetalleRow)ds.DatosDetalle.NewDatosDetalleRow();
            //dr.HojaRutaID = 0;
            dr.NroHojaRuta         = Convert.ToInt32(this.txtNroHojaRutaManual.Text);
            dr.NroSucursalHojaRuta = this.txtNroSucursalHRManual.Text;
            dr.NroCarpeta          = (this.txtNroCarpetaHRManual.Text == "") ? 0 : Convert.ToInt32(this.txtNroCarpetaHRManual.Text);

            ds.DatosDetalle.AddDatosDetalleRow(dr);
            Session["HojasRutaManuales"] = ds;

            //int iNewItemIndex = this.dtgHojasRutaManuales.Items.Count;

            this.dtgHojasRutaManuales.DataSource = ds.DatosDetalle;
            //this.dtgHojasRutaManuales.EditItemIndex = iNewItemIndex;
            this.dtgHojasRutaManuales.DataBind();

            this.txtNroHojaRutaManual.Text   = "";
            this.txtNroSucursalHRManual.Text = "";
            this.txtNroCarpetaHRManual.Text  = "";
        }
Beispiel #10
0
        public bool Guardar(DsPlanillaHojaRuta dsAutomatizadas, DsPlanillaHojaRuta dsManuales)
        {
            using (SqlConnection conexion = new SqlConnection())
            {
                SqlTransaction transaccion = null;
                conexion.ConnectionString = Config.ConnectionString;
                try
                {
                    conexion.Open();
                    transaccion = conexion.BeginTransaction();

                    if (this.PlanillaHojaRutaID == 0)
                    {
                        this.PlanillaHojaRutaID = Convert.ToInt32(Config.Conexion.EjecutarResultadoUnico(transaccion, "PlanillaHojaRutaINS", this.NroPlanilla, this.ServicioTransporteIdaID, this.ServicioTransporteVueltaID));
                    }
                    else
                    {
                        Config.Conexion.EjecutarSinResultados(transaccion, "PlanillaHojaRutaUPD", this.PlanillaHojaRutaID, this.NroPlanilla, this.ServicioTransporteIdaID, this.ServicioTransporteVueltaID);
                    }

                    PlanillaHojaRutaDetalle detalle = new PlanillaHojaRutaDetalle();

                    foreach (DsPlanillaHojaRuta.DatosDetalleRow dr in dsAutomatizadas.DatosDetalle.Rows)
                    {
                        detalle.Automatizada        = true;
                        detalle.HojaRutaID          = dr.HojaRutaID;
                        detalle.NroCarpeta          = dr.NroCarpeta;
                        detalle.NroHojaRuta         = dr.NroHojaRuta;
                        detalle.NroSucursalHojaRuta = dr.NroSucursalHojaRuta;
                        detalle.PlanillaHojaRutaID  = this.PlanillaHojaRutaID;

                        if (!detalle.Guardar(transaccion))
                        {
                            transaccion.Rollback();
                            return(false);
                        }
                    }

                    foreach (DsPlanillaHojaRuta.DatosDetalleRow dr in dsManuales.DatosDetalle.Rows)
                    {
                        detalle.PlanillaHojaRutaDetalleID = 0;
                        detalle.Automatizada        = false;
                        detalle.HojaRutaID          = 0;
                        detalle.NroCarpeta          = dr.NroCarpeta;
                        detalle.NroHojaRuta         = dr.NroHojaRuta;
                        detalle.NroSucursalHojaRuta = dr.NroSucursalHojaRuta;
                        detalle.PlanillaHojaRutaID  = this.PlanillaHojaRutaID;

                        if (!detalle.Guardar(transaccion))
                        {
                            transaccion.Rollback();
                            return(false);
                        }
                    }

                    transaccion.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    transaccion.Rollback();
                    throw ex;
                }
            }
        }