Esempio n. 1
0
        private void txtMoraMensual_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (txtMoraMensual.Text == string.Empty)
                {
                    MessageBox.Show("Mora Mensual esta vacia, digite una cantidad valida", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMoraMensual.Focus();
                }
                else if (txtMoraSemanal.Text == string.Empty)
                {
                    MessageBox.Show("Mora Semanal esta vacia, digite una cantidad valida", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtMoraSemanal.Focus();
                }
                else if (txtPagoMensual.Text == string.Empty)
                {
                    MessageBox.Show("Pago Mensual esta vacio, digite una cantidad valida", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtPagoMensual.Focus();
                }
                else if (txtPagoSemanal.Text == string.Empty)
                {
                    MessageBox.Show("Pago semanal esta vacio, digite una cantidad valida", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtPagoSemanal.Focus();
                }
                else
                {
                    try
                    {
                        Mora pMora = new Mora();
                        pMora.Mora_Mensual = txtMoraMensual.Text;
                        pMora.Mora_Semanal = txtMoraSemanal.Text;
                        pMora.Pago_Mensual = txtPagoMensual.Text;
                        pMora.Pago_Semanal = txtPagoSemanal.Text;

                        int r = MoraDB.ModificarVIP(pMora);
                        if (r > 0)
                        {
                            MessageBox.Show("Modificado con Exito", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            dgvPagosVIP.DataSource = MoraDB.VerMorayPagosVIP();
                            txtMoraMensual.Clear();
                            txtMoraSemanal.Clear();
                            txtPagoMensual.Clear();
                            txtPagoSemanal.Clear();
                        }
                        else
                        {
                            MessageBox.Show("No se pudo Modificar, Intentelo Nuevamente", "Pagos VIP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Esempio n. 2
0
        public static int Registrar(Mora pMora)
        {
            int R = -1;

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("insert into Mora (Mora_Mensual, Mora_Semanal) values ({0}, {1})", pMora.Mora_Mensual, pMora.Mora_Semanal), conexion);
                R = comando.ExecuteNonQuery();
                conexion.Close();
            }
            return(R);
        }
Esempio n. 3
0
        public static int Modificar(Mora pMora)
        {
            int R = -1;

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("Update Mora set Mora_Mensual = {0}, Mora_Semanal = {1} where ID = 1 update CantidadPago set Pago_Mensual = {2}, Pago_Semanal = {3} where CantidadPago.ID = 1", pMora.Mora_Mensual, pMora.Mora_Semanal, pMora.Pago_Mensual, pMora.Pago_Semanal), conexion);
                R = comando.ExecuteNonQuery();
                conexion.Close();
            }
            return(R);
        }
Esempio n. 4
0
        public static int ModificarVIP(Mora pM)
        {
            int r = -1;

            using (SqlConnection con = DBcomun.ObetenerConexion())
            {
                SqlCommand comand = new SqlCommand(string.Format("update CantidadPagoVIP set Pago_VIP = {0}, Pago_Semanal = {1}, Mora_Semanal = {2}, Mora_Mensual = {3} where ID = 1", pM.Pago_Mensual, pM.Pago_Semanal, pM.Mora_Semanal, pM.Mora_Mensual), con);
                r = comand.ExecuteNonQuery();
                con.Close();
            }
            return(r);
        }
Esempio n. 5
0
        private void txtMoraPagoMensual_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                try
                {
                    if (MessageBox.Show("Seguro que Desea Modificar la Tarifa?", "Pagos y Mora", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (txtMoraPagoMensual.Text == string.Empty || txtMoraPagoSemanal.Text == string.Empty || txtPagoMensual.Text == string.Empty || txtPagoSemanal.Text == string.Empty)
                        {
                            MessageBox.Show("Complete todos los campos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            Mora pM = new Mora();
                            pM.Mora_Mensual = txtMoraPagoMensual.Text;
                            pM.Mora_Semanal = txtMoraPagoSemanal.Text;
                            pM.Pago_Mensual = txtPagoMensual.Text;
                            pM.Pago_Semanal = txtPagoSemanal.Text;

                            int R = MoraDB.Modificar(pM);
                            if (R > 0)
                            {
                                MessageBox.Show("Pagos Modificados con Exito!", "Pagos y Mora", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                dgvTabla.DataSource = MoraDB.VerMorayPagos();
                                txtMoraPagoMensual.Clear();
                                txtMoraPagoSemanal.Clear();
                                txtPagoMensual.Clear();
                                txtPagoSemanal.Clear();
                            }
                            else
                            {
                                MessageBox.Show("Error, No se pudo Modificar", "Pagos y Mora", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    else
                    {
                    };
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Pagos y Mora", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Esempio n. 6
0
        public static Mora GetVIPpayments()
        {
            Mora pM = new Mora();

            using (SqlConnection con = DBcomun.ObetenerConexion())
            {
                SqlCommand    comand = new SqlCommand(string.Format("select * from CantidadPagoVIP"), con);
                SqlDataReader reader = comand.ExecuteReader();
                while (reader.Read())
                {
                    pM.Mora_Mensual = reader["Mora_Mensual"].ToString();
                    pM.Mora_Semanal = reader["Mora_Semanal"].ToString();
                    pM.Pago_Mensual = reader["Pago_VIP"].ToString();
                    pM.Pago_Semanal = reader["Pago_Semanal"].ToString();
                }
                con.Close();
            }
            return(pM);
        }
Esempio n. 7
0
        public static List <Mora> VerMorayPagosVIP()
        {
            List <Mora> list = new List <Mora>();

            using (SqlConnection con = DBcomun.ObetenerConexion())
            {
                SqlCommand    comand = new SqlCommand(string.Format("select * from CantidadPagoVIP"), con);
                SqlDataReader reader = comand.ExecuteReader();
                while (reader.Read())
                {
                    Mora pM = new Mora();
                    pM.Mora_Mensual = reader["Mora_Mensual"].ToString();
                    pM.Mora_Semanal = reader["Mora_Semanal"].ToString();
                    pM.Pago_Mensual = reader["Pago_VIP"].ToString();
                    pM.Pago_Semanal = reader["Pago_Semanal"].ToString();
                    list.Add(pM);
                }
                con.Close();
            }
            return(list);
        }
Esempio n. 8
0
        public static List <Mora> VerMorayPagos()
        {
            List <Mora> List = new List <Mora>();

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand    comando = new SqlCommand(string.Format("Select CantidadPago.Pago_Mensual, Mora.Mora_Mensual, CantidadPago.Pago_Semanal, Mora.Mora_Semanal from CantidadPago, Mora where CantidadPago.ID = Mora.ID"), conexion);
                SqlDataReader reader  = comando.ExecuteReader();
                while (reader.Read())
                {
                    Mora pM = new Mora();
                    pM.Pago_Mensual = reader.GetDecimal(0).ToString("f2");
                    pM.Mora_Mensual = reader.GetDecimal(1).ToString("f2");
                    pM.Pago_Semanal = reader.GetDecimal(2).ToString("f2");
                    pM.Mora_Semanal = reader.GetDecimal(3).ToString("f2");
                    List.Add(pM);
                }
                conexion.Close();
            }
            return(List);
        }