Exemple #1
0
 public bool actualizarMulta(MultaBE ocheck)
 {
     try
     {
         return(oMultaDA.actualizar(ocheck));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #2
0
 public bool AgregarMulta(MultaBE omulta, CheckListMultaBE ocheck)
 {
     try
     {
         return(oMultaDA.agregar(omulta, ocheck));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #3
0
        public List <MultaBE> ListarMulta(int IdCheck)
        {
            using (OracleCommand oOracleCommand = new OracleCommand("PKG_RESERVA.SP_LISTAR_MULTA", conn))
            {
                try
                {
                    oOracleCommand.CommandType    = CommandType.StoredProcedure;
                    oOracleCommand.CommandTimeout = 10;
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_ID_CHECK_LIST", IdCheck));
                    OracleParameter oParam = new OracleParameter("CUR_RESERVAS", OracleDbType.RefCursor);
                    oParam.Direction = ParameterDirection.Output;
                    oParam.Size      = 128;

                    oOracleCommand.Parameters.Add(oParam);


                    DataTable oDataTable = new DataTable();
                    conn.Open();
                    oDataTable.Load(oOracleCommand.ExecuteReader());
                    conn.Close();
                    listCheck = new List <MultaBE>();
                    foreach (DataRow item in oDataTable.Rows)
                    {
                        oMulta      = new MultaBE();
                        oCheckMulta = new CheckListMultaBE();
                        oCheckMulta.CheckList.IdCheckIn = int.Parse(item[0].ToString());
                        oMulta.IdMulta          = int.Parse(item[1].ToString());
                        oMulta.Comentario       = item[2].ToString();
                        oMulta.DescripcionMulta = item[3].ToString();
                        oMulta.ValorMulta       = int.Parse(item[4].ToString());



                        listCheck.Add(oMulta);
                    }
                    return(listCheck);
                }
                catch (Exception ex)
                {
                    return(null);
                    // throw new Exception(ex.Message);
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }
Exemple #4
0
        private void GvcheckList_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            try
            {
                oListcheck = new List <MultaBE>();
                MultaBE oCheck = new MultaBE();
                oCheck = (MultaBE)((DataGrid)sender).CurrentItem;
                var columna = ((DataGrid)sender).CurrentColumn.Header;

                foreach (MultaBE item in ((List <MultaBE>)((DataGrid)sender).ItemsSource).ToList())
                {
                    btnAceptar.IsEnabled = false;
                    oMultaBE             = new MultaBE();
                    oMultaBE             = item;
                    oMultaBE.IsSelected  = false;
                    if (item.IdMulta.Equals(oCheck.IdMulta))
                    {
                        oMultaBE.IsSelected = true;

                        btnEditar.IsEnabled = true;

                        txtValorMulta.Text  = oCheck.ValorMulta.ToString();
                        txtDescripcion.Text = oCheck.DescripcionMulta;
                        txtComentario.Text  = oCheck.Comentario;
                        id_multa            = oCheck.IdMulta;

                        btnAceptar.IsEnabled = false;
                    }

                    oListcheck.Add(oMultaBE);
                }
                btnEditar.IsEnabled            = true;
                ((DataGrid)sender).ItemsSource = oListcheck;
                if (columna.Equals(" "))
                {
                    if (count < 1)
                    {
                        BtnEliminar_Click(sender, null);
                        count++;
                    }
                    else
                    {
                        count = 0;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #5
0
        public bool actualizar(MultaBE ochech)
        {
            using (OracleCommand oOracleCommand = new OracleCommand("PKG_RESERVA.SP_ACTUALIZAR_MULTA", conn))
            {
                try
                {
                    oOracleCommand.CommandType    = CommandType.StoredProcedure;
                    oOracleCommand.CommandTimeout = 10;
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_ID_CHECK_LIST", ochech.idCheck));
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_ID_MULTA", ochech.IdMulta));
                    oOracleCommand.Parameters.Add(new OracleParameter("PS_DESCRIPCION_MULTA", ochech.DescripcionMulta));
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_VALOR_MULTA", ochech.ValorMulta));
                    oOracleCommand.Parameters.Add(new OracleParameter("PS_COMENTARIO_USUARIO", ochech.Comentario));



                    OracleParameter oParam = new OracleParameter("S_RESULTADO", OracleDbType.Varchar2);
                    oParam.Direction = ParameterDirection.Output;
                    oParam.Size      = 128;
                    oOracleCommand.Parameters.Add(oParam);
                    conn.Open();
                    oOracleCommand.ExecuteReader();

                    string respuesta = oOracleCommand.Parameters["S_RESULTADO"].Value.ToString();
                    //0 es igual a se realizo la acción.........
                    //1 es igual ocurrio algo que no se puedo realizar la acción

                    if (respuesta.Equals("0"))
                    {
                        return(true);
                    }
                    return(false);
                }
                catch (Exception ex)
                {
                    return(false);
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }
Exemple #6
0
        private async void btnAceptar_Click(object sender, RoutedEventArgs e)
        {
            Task <bool> taskmensaje = new Task <bool>(CorreoBL.TimeMensaje);

            try
            {
                oMultaBL      = new MultaBL();
                oMultaBE      = new MultaBE();
                oCheckMultaBE = new CheckListMultaBE();

                if (txtValorMulta.Text.Trim().Length.Equals(0))
                {
                    txtValorMulta.Focus();
                    throw new Exception("Ingrese el valor de la multa");
                }
                if (!IsNumerico(txtValorMulta.Text))
                {
                    txtValorMulta.Focus();
                    throw new Exception("El valor de la multa debe ser numérico");
                }

                oMultaBE.DescripcionMulta         = txtDescripcion.Text;
                oMultaBE.ValorMulta               = int.Parse(txtValorMulta.Text);
                oCheckMultaBE.ComentarioUsuario   = txtComentario.Text;
                oCheckMultaBE.CheckList.IdCheckIn = id_check_list;
                btnAceptar.IsEnabled              = false;
                SnackbarCorrecto.IsActive         = true;
                SnackbarCorrecto.Message.Content  = "Se esta registrando la multa...";
                taskmensaje.Start();
                bool respp = await taskmensaje;
                taskmensaje = new Task <bool>(CorreoBL.TimeMensaje);

                if (oMultaBL.AgregarMulta(oMultaBE, oCheckMultaBE))
                {
                    txtComentario.Text = "";
                    txtValorMulta.Text = "0";
                    ListaCheck(id_check_list);
                    Limpiar();
                    SnackbarCorrecto.IsActive        = true;
                    SnackbarCorrecto.Message.Content = "Se registro correctamente la multa";
                    taskmensaje.Start();
                    bool resp = await taskmensaje;
                    if (resp)
                    {
                        SnackbarCorrecto.IsActive = false;
                    }
                }
                else
                {
                    SnackbarCorrecto.IsActive     = false;
                    SnackbarError.IsActive        = true;
                    SnackbarError.Message.Content = "Algo ocurrió, inténtelo más tarde ";
                    taskmensaje.Start();
                    bool resp = await taskmensaje;
                    if (resp)
                    {
                        SnackbarError.IsActive = false;
                    }
                }
            }
            catch (Exception ex)
            {
                SnackbarCorrecto.IsActive     = false;
                SnackbarError.IsActive        = true;
                SnackbarError.Message.Content = ex.Message;
                taskmensaje.Start();
                bool resp = await taskmensaje;
                if (resp)
                {
                    SnackbarError.IsActive = false;
                }
            }
        }