Esempio n. 1
0
 public bool AgregarMulta(MultaBE omulta, CheckListMultaBE ocheck)
 {
     try
     {
         return(oMultaDA.agregar(omulta, ocheck));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Esempio n. 2
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();
                    }
                }
            }
        }
Esempio n. 3
0
        public bool agregar(MultaBE omulta, CheckListMultaBE ocheckMulta)
        {
            using (OracleCommand oOracleCommand = new OracleCommand("PKG_RESERVA.SP_CREAR_MULTA", conn))
            {
                try
                {
                    oOracleCommand.CommandType    = CommandType.StoredProcedure;
                    oOracleCommand.CommandTimeout = 10;
                    oOracleCommand.Parameters.Add(new OracleParameter("PS_DESCRIPCION_MULTA", omulta.DescripcionMulta));
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_VALOR_MULTA", omulta.ValorMulta));
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_CHECK_LIST_ID", ocheckMulta.CheckList.IdCheckIn));
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_COMENTARIO_USUARIO", ocheckMulta.ComentarioUsuario));


                    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();
                    }
                }
            }
        }
Esempio n. 4
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;
                }
            }
        }