private void Consultar()
        {
            this.txtPlanillaHojaRutaID.Text = this.Request.QueryString["PlanillaHojaRutaID"];
            IPlanillaHojaRuta planilla = PlanillaHojaRutaFactory.GetPlanillaHojaRuta();

            planilla.PlanillaHojaRutaID = Convert.ToInt32(this.txtPlanillaHojaRutaID.Text);
            planilla.Consultar();

            IServicioTransporte servicio = ServicioTransporteFactory.GetServicioTransporte();

            servicio.ServicioTransporteID = planilla.ServicioTransporteIdaID;
            servicio.ConsultarActivosInactivos();
            this.lblServicioIdaDescrip.Text = servicio.ServicioTransporteDescrip;
            servicio.ServicioTransporteID   = planilla.ServicioTransporteVueltaID;
            servicio.ConsultarActivosInactivos();
            this.lblServicioVueltaDescrip.Text = servicio.ServicioTransporteDescrip;

            this.txtNroPlanillaHojaRuta.Text = planilla.NroPlanilla.ToString();

            this.BindGridAutomatizadasConsulta();

            this.BindGridManualConsulta();

            this.tblHojasRutaAutomatizadas.Attributes.Add("Style", "Display: inline");
            this.tblHojasRutaManuales.Attributes.Add("Style", "Display: inline");
            //this.tblGuardar.Attributes.Add("Style", "Display: none");
            this.butGuardar.Attributes.Add("Style", "Display: none");
            this.tblServicios.Attributes.Add("Style", "Display: inline");
            this.tblServicioIda.Attributes.Add("Style", "Display: none");
            this.tblServicioVuelta.Attributes.Add("Style", "Display: none");

            this.DeshabilitarCampos();
        }
        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();
        }
Пример #5
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);
            }
        }