Beispiel #1
0
        //CONTROL DE PRECIOS
        public bool actualizarPrecios(eNIVEL nivel, DataGridViewRowCollection PRECIOS, DateTime fecha, string autorizo)
        {
            bool OK = true;
            string datos = "";
            try
            {
                foreach (DataGridViewRow row in PRECIOS)
                {
                    switch (nivel)
                    {
                        case eNIVEL.PRENDASAL:
                            datos = datos + row.Cells["KilatajeN"].Value.ToString() + ">" + Decimal.Parse(row.Cells["PrecioN"].Value.ToString()) +  "&";
                            break;
                        case eNIVEL.AMIGO:
                            datos = datos + row.Cells["KilatajeA"].Value.ToString() + ">" + Decimal.Parse(row.Cells["PrecioA"].Value.ToString()) + "&";
                            break;
                        case eNIVEL.VIP:
                            datos = datos + row.Cells["KilatajeV"].Value.ToString() + ">" + Decimal.Parse(row.Cells["PrecioV"].Value.ToString()) + "&";
                            break;
                        case eNIVEL.MAYOREO:
                            datos = datos + row.Cells["KilatajeM"].Value.ToString() + ">" + Decimal.Parse(row.Cells["PrecioM"].Value.ToString()) + "&";
                            break;
                    }

                }
                string sql = "prendasal.SP_SET_PRECIOS";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter n = cmd.Parameters.Add("nivelP", MySqlDbType.Int32);
                n.Direction = ParameterDirection.Input;
                MySqlParameter f = cmd.Parameters.Add("fechaP", MySqlDbType.Date);
                f.Direction = ParameterDirection.Input;
                MySqlParameter auto = cmd.Parameters.Add("autorizoP", MySqlDbType.VarChar, 15);
                auto.Direction = ParameterDirection.Input;
                MySqlParameter items = cmd.Parameters.Add("items", MySqlDbType.LongText);
                items.Direction = ParameterDirection.Input;

                n.Value = (int)nivel;
                f.Value = fecha.Date.ToString("yyyy-MM-dd"); ;
                auto.Value = autorizo.ToUpper();
                items.Value = datos;

                cmd.ExecuteNonQuery();
                MessageBox.Show("PRECIOS " + nivel.ToString() + " ACTUALIZADOS", "OPERACION FINALIZADA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception e)
            {
                OK = false;
                MessageBox.Show(null, e.Message, "ERROR AL ACTUALIZAR PRECIOS " + nivel.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return OK;
        }
Beispiel #2
0
        public DataTable findByNumTarjeta(string num ,eNIVEL tipoT)
        {
            MySqlDataReader reader;
            DataTable datos = new DataTable();
            try
            {
                string sql = "prendasal.SP_GET_TARJETA";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter numero = cmd.Parameters.Add("numero", MySqlDbType.VarChar, 50);
                numero.Direction = ParameterDirection.Input;
                MySqlParameter tipo = cmd.Parameters.Add("tipoT", MySqlDbType.Int32);
                tipo.Direction = ParameterDirection.Input;

                numero.Value = num;
                tipo.Value = (int)tipoT;

                reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    datos.Load(reader);
                }
                reader.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show("NO SE PUDO CONSULTAR TARJETA "+tipoT.ToString()+"\n" + e.Message, "ERROR EN CONSULTA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return datos;
        }
Beispiel #3
0
        public DataRow getReglas(eNIVEL nivel)
        {
            MySqlDataReader reader;
            // Creamos nuestro queridisimo DataSet
            DataTable datos = new DataTable();
            try
            {
                string sql = "prendasal.SP_GET_REGLAS";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter n = cmd.Parameters.Add("nivelR", MySqlDbType.Int32);
                n.Direction = ParameterDirection.Input;

                n.Value = (int)nivel;

                reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    datos.Load(reader);
                }
                reader.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show("NO SE PUDO CONSULTAR LOS PARAMETROS PARA CLIENTE: " + nivel.ToString(), "ERROR EN CONSULTA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return datos.Rows[datos.Rows.Count - 1];
        }