Beispiel #1
0
        protected void btnBucaNotaPedido_Click(object sender, EventArgs e)
        {
            DataTable dtNotaPedido = new DataTable();

            dtNotaPedido  = SPs.AutpBuscaNotaPedido(txtNotaPedido.Text).GetDataSet().Tables[0];
            lMensaje.Text = "";

            if (dtNotaPedido.Rows.Count != 0)  // ,nota: Verifico si existen resultados para el paciente.
            {
                ddlDominio.SelectedValue = dtNotaPedido.Rows[0].ItemArray[5].ToString();

                ddlEfector.SelectedValue = dtNotaPedido.Rows[0].ItemArray[2].ToString();
                txtObservacion.Text      = dtNotaPedido.Rows[0].ItemArray[2].ToString();
            }
            else
            {
                lMensaje.Text = "No existe Nota de pedido " + txtNotaPedido.Text;
                cargarCombos();
                txtObservacion.Text = "";



                //inputFecha.Value = oOrdenReparacion.Fecha.ToString();
                //ddlDominio.SelectedValue = oOrdenReparacion.IdVehiculo.ToString();
                //txtNotaPedido.Text = oOrdenReparacion.IdNotaPedido.ToString();
                //ddlProveedor.SelectedValue = oOrdenReparacion.IdProveedor.ToString();
                //txtPresupuesto.Text = oOrdenReparacion.IdPresupuesto.ToString();
                //txtDescripcion.Text = oOrdenReparacion.Descripcion.ToString();
                //txtObservacion.Text = oOrdenReparacion.Observacion.ToString();
                //inputFechaInicio.Value = oOrdenReparacion.FechaInicio.ToString();
                //inputFechaFin.Value = oOrdenReparacion.FechaFin.ToString();
            }
        }
Beispiel #2
0
        // -----------------------------------------------------------------------------------------------------------

        private bool hayError()
        {
            bool hayError = false;

            lblMensaje.Text      = "";
            TablaErrores.Visible = false;


            // ------------------------------------------------------------------------
            // Verifico nota de pedido que no este en otra orden de reparacion
            // ------------------------------------------------------------------------

            //int idOrdenReparacion = SubSonic.Sugar.Web.QueryString<int>("idOrdenReparacion");
            //AutOrdenReparacion oOrdenReparacion = new AutOrdenReparacion(idOrdenReparacion);



            //DataTable dtBuscaNotaPedidoORep = new DataTable();

            //dtBuscaNotaPedidoORep = SPs.AutpBuscaNotaPedidoORep(txtNotaPedido.Text).GetDataSet().Tables[0];
            lMensaje.Text = "";

            //if (inputFecha.Value < inputFechaFin.Value)



            if (txtNotaPedido.Text == "")
            {
                //MessageBox.Show("Seleccione Dominio del Vehiculo");
                lblMensaje.Text      = "Nro de nota de Pedido Incompleta";
                hayError             = true;
                TablaErrores.Visible = true;
            }


            DataTable dtNotaPedido = new DataTable();

            dtNotaPedido  = SPs.AutpBuscaNotaPedido(txtNotaPedido.Text).GetDataSet().Tables[0];
            lMensaje.Text = "";

            if (dtNotaPedido.Rows.Count == 0)  // ,nota: Verifico si existen resultados para el paciente.
            {
                //ddlDominio.SelectedIndex = int.Parse(dtNotaPedido.Rows[0].ItemArray[5].ToString());

                lblMensaje.Text      = "Seleccione Nro de Nota de Pedido existente";
                hayError             = true;
                TablaErrores.Visible = true;
            }


            if (this.inputFecha.Value.CompareTo(this.inputFechaFin.Value) == 0)
            {
                lblMensaje.Text      = "Fecha de inicio no puede ser menor a la fecha de fin del trabajo";
                hayError             = true;
                TablaErrores.Visible = true;
            }

            if (ddlDominio.SelectedValue == "0")
            {
                lblMensaje.Text      = "Seleccione Dominio del Vehiculo";
                hayError             = true;
                TablaErrores.Visible = true;
            }

            if (ddlEfector.SelectedValue == "0")
            {
                lblMensaje.Text      = "Seleccione Efector";
                hayError             = true;
                TablaErrores.Visible = true;
            }

            if (ddlProveedor.SelectedValue == "0")
            {
                //MessageBox.Show("Seleccione Dominio del Vehiculo");
                lblMensaje.Text      = "Seleccione Proveedor";
                hayError             = true;
                TablaErrores.Visible = true;
            }
            if (txtKm.Text == "")
            {
                //MessageBox.Show("Seleccione Dominio del Vehiculo");
                lblMensaje.Text      = "Ingrese algun valor a los km";
                hayError             = true;
                TablaErrores.Visible = true;
            }



            //daniel san, decime como hago para comparar el valor de esta varible idordenreparacion en este if
            //if (idOrdenReparacion = 0)
            //    {
            //    if (dtBuscaNotaPedidoORep.Rows.Count != 0)  // ,nota: Verifico si existen resultados para el paciente.
            //        {
            //            lblMensaje.Text = "Nota Pedido usada en Orden reparacion " + int.Parse(dtBuscaNotaPedidoORep.Rows[0].ItemArray[0].ToString()) + " Vehiculo " + dtBuscaNotaPedidoORep.Rows[0].ItemArray[2].ToString() + " Efector " + dtBuscaNotaPedidoORep.Rows[0].ItemArray[3].ToString();
            //            hayError = true;
            //            TablaErrores.Visible = true;
            //        }
            //    }
            // ------------------------------------------------------------------------
            // Verifico que el año no sea vacío
            // ------------------------------------------------------------------------

            //if (txtAnio.Text == "")

            //{
            //    lblMensaje.Text += "El Año no puede ser vacío. <br/>";
            //    hayError = true;
            //    TablaErrores.Visible = true;
            //}

            // ------------------------------------------------------------------------
            // Verifico que no exista el nro. de Matrícula en otro registro en la base.
            // ------------------------------------------------------------------------

            //if (txtMatricula.Text != "")
            //{
            //    SubSonic.Select pMatricula = new SubSonic.Select();
            //    pMatricula.From(AutVehiculo.Schema);
            //    pMatricula.Where(AutVehiculo.Columns.Matricula).IsEqualTo(txtMatricula.Text);

            //    DataTable dtMatricula = pMatricula.ExecuteDataSet().Tables[0];

            //    if ((Request["idVehiculo"] == null) && (dtMatricula.Rows.Count > 0))
            //    {
            //        lblMensaje.Text += "El Número de Matrícula ya esta asignado a un vehículo. <br/>";
            //        hayError = true;
            //        TablaErrores.Visible = true;
            //    }
            //}

            // --------------------------------------------------------------
            // Verifico que no exista el Dominio en otro registro en la base.
            // --------------------------------------------------------------
            //if (txtDominio.Text != "")
            //{
            //    SubSonic.Select pDominio = new SubSonic.Select();
            //    pDominio.From(AutVehiculo.Schema);
            //    pDominio.Where(AutVehiculo.Columns.Dominio).IsEqualTo(txtDominio.Text);

            //    DataTable dtDominio = pDominio.ExecuteDataSet().Tables[0];

            //    if ((Request["idVehiculo"] == null) && (dtDominio.Rows.Count > 0))
            //    {
            //        lblMensaje.Text += "El Dominio ya esta asignado a un vehículo. <br/>";
            //        hayError = true;
            //        TablaErrores.Visible = true;
            //    }
            //}
            //else
            //{
            //    lblMensaje.Text += "El Dominio no puede ser vacío. <br/>";
            //    hayError = true;
            //    TablaErrores.Visible = true;
            //}

            // ----------------------------------------------------------------
            // Fecha del odómetro
            // ----------------------------------------------------------------
            if (Request["idVehiculo"] == null) // Nuevo Vehículo
            {
                //if (inputFechaLecturaOdometro.Value == "")
                //{
                //    lblMensaje.Text += "El campo 'Fecha de la última lectura' del odómetro no puede ser vacío. <br/>";
                //    hayError = true;
                //    TablaErrores.Visible = true;
                //}
            }

            // ----------------------------------------------------------------
            // Verifico que el Nro. de Motor y el Nro. de Chasis no sean vacíos
            // ----------------------------------------------------------------
            //if (txtNumeroMotor.Text == "")
            //{
            //    lblMensaje.Text += "El campo 'Nro. de Motor' no puede ser vacío. <br/>";
            //    hayError = true;
            //    TablaErrores.Visible = true;
            //}

            //if (txtNumeroChasis.Text == "")
            //{
            //    lblMensaje.Text += "El campo 'Nro. de Chasis' no puede ser vacío. <br/>";
            //    hayError = true;

            //    TablaErrores.Visible = true;
            //}

            // Respondo ...
            return(hayError);
        }