Пример #1
0
        private void actualizar()
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select r.rol_habilitado, r.rol_id, r.rol_nombre from SOCORRO.Rol r order by rol_id", conexion);

            command.CommandType = CommandType.Text;
            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);

            SqlCommand command2 = new SqlCommand("select rol_nombre,r.rol_id,f.func_id, func_descripcion from SOCORRO.Rol r join(SOCORRO.FuncionalidadxRol fxr join SOCORRO.Funcionalidad f on fxr.func_id = f.func_id) on r.rol_id = fxr.rol_id order by r.rol_id", conexion);

            command2.CommandType = CommandType.Text;
            DBConnection.fill_grid(dataGridView2, command2, adapter2, table2);


            List <Rol> roles = DBConnection.getRoles();

            comboBox_roles.Items.Clear();
            foreach (Rol r in roles)
            {
                comboBox_roles.Items.Add(r.nombre);
            }
            if (comboBox_roles.Items.Count > 0)
            {
                comboBox_roles.SelectedIndex = 0;
            }

            dataGridView1.Columns["rol_id"].ReadOnly = true;
        }
Пример #2
0
        private void MisCupones_Load(object sender, EventArgs e)
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("SOCORRO.sp_mostrar_mis_cupones", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@user_id", usuActivo.id);
            command.ExecuteNonQuery();

            SqlDataAdapter adapter1 = new SqlDataAdapter();
            DataTable      table1   = new DataTable();

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);

            comboBox1.Visible = false;
            label3.Visible    = false;
            button3.Visible   = false;

            foreach (Rol r in usuActivo.roles)
            {
                if (DBConnection.isAdmin(r))
                {
                    comboBox1.Visible = true;
                    List <Cliente> clientes = ClienteDAO.getClientes();
                    foreach (Cliente c in clientes)
                    {
                        comboBox1.Items.Add(c.id);
                    }
                    label3.Visible         = true;
                    button3.Visible        = true;
                    comboBox1.SelectedItem = ClienteDAO.obtenerIdCliente(usuActivo);
                    return;
                }
            }
        }
Пример #3
0
        void actualizar()
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select * from SOCORRO.Usuario", conexion);

            command.CommandType = CommandType.Text;
            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
            dataGridView1.Columns["user_id"].ReadOnly       = true;
            dataGridView1.Columns["user_pass"].ReadOnly     = true;
            dataGridView1.Columns["user_username"].ReadOnly = true;
        }
Пример #4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            //    if (textBox1.Text == "")
            //      return;
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select * from SOCORRO.Usuario where user_username LIKE '%'+@nombre+'%'", conexion);

            command.CommandType = CommandType.Text;
            command.Parameters.AddWithValue("@nombre", textBox1.Text);
            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
        }
Пример #5
0
        private void actualizar()
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select p.prov_id,p.prov_user_id, p.prov_cuit,p.prov_razon_social,p.prov_nombre_contacto,r.rubro_descripcion, p.prov_ciudad,p.prov_codigo_postal,p.prov_direccion,p.prov_telefono,p.prov_email, p.prov_habilitado, p.prov_rubro_id from (SOCORRO.Proveedor p join SOCORRO.Rubro r on p.prov_rubro_id = r.rubro_id) join SOCORRO.RolxUsuario ro on p.prov_user_id = ro.user_id where ro.rol_id = 2", conexion);

            command.CommandType = CommandType.Text;
            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
            dataGridView1.Columns["prov_rubro_id"].Visible = false;
            dataGridView1.Columns["prov_id"].ReadOnly      = true;
            dataGridView1.Columns["prov_user_id"].ReadOnly = true;
        }
Пример #6
0
        private void actualizar()
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select * from SOCORRO.Cliente c join SOCORRO.RolxUsuario r on c.clie_user_id = r.user_id where rol_id = 1", conexion);

            command.CommandType = CommandType.Text;

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
            dataGridView1.Columns["clie_id"].ReadOnly      = true;
            dataGridView1.Columns["clie_user_id"].ReadOnly = true;
            dataGridView1.Columns["clie_saldo"].ReadOnly   = true;
            dataGridView1.Columns["rol_id"].Visible        = false;
        }
Пример #7
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("SOCORRO.sp_cupones_cliente", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@clie_id", Convert.ToInt16(comboBox1.SelectedItem));
            command.ExecuteNonQuery();
            SqlDataAdapter adapter1 = new SqlDataAdapter();
            DataTable      table1   = new DataTable();

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
        }
Пример #8
0
        private void AbmRol_Load(object sender, EventArgs e)
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select r.rol_id,r.rol_habilitado, r.rol_nombre from SOCORRO.Rol r order by r.rol_id", conexion);

            command.CommandType = CommandType.Text;

            adapter1 = new SqlDataAdapter();
            table1   = new DataTable();

            adapter1.UpdateCommand             = new SqlCommand("SOCORRO.sp_modificar_rol", conexion);
            adapter1.UpdateCommand.CommandType = CommandType.StoredProcedure;
            adapter1.UpdateCommand.Parameters.Add("@rol_habilitado", SqlDbType.Bit, 1, "rol_habilitado");
            adapter1.UpdateCommand.Parameters.Add("@rol_nombre", SqlDbType.NVarChar, 20, "rol_nombre");
            SqlParameter parameter = adapter1.UpdateCommand.Parameters.Add("@rol_id", SqlDbType.Int);

            parameter.SourceColumn  = "rol_id";
            parameter.SourceVersion = DataRowVersion.Original;

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);

            SqlCommand command2 = new SqlCommand("select r.rol_id,r.rol_nombre, f.func_id,f.func_descripcion from SOCORRO.Rol r join SOCORRO.FuncionalidadxRol fxr on fxr.rol_id = r.rol_id join SOCORRO.Funcionalidad f  on f.func_id = fxr.func_id order by r.rol_id,f.func_id", conexion);

            command2.CommandType = CommandType.Text;

            adapter2 = new SqlDataAdapter();
            table2   = new DataTable();

            DBConnection.fill_grid(dataGridView2, command2, adapter2, table2);

            List <Funcionalidad> funcs = DBConnection.getFuncs();

            foreach (Funcionalidad f in funcs)
            {
                comboBox_funcionalidades.Items.Add(f.nombre);
            }
            comboBox_funcionalidades.SelectedIndex = 0;
            List <Rol> roles = DBConnection.getRoles();

            comboBox_roles.Items.Clear();
            foreach (Rol r in roles)
            {
                comboBox_roles.Items.Add(r.nombre);
            }
            if (comboBox_roles.Items.Count > 0)
            {
                comboBox_roles.SelectedIndex = 0;
            }

            dataGridView1.Columns["rol_id"].ReadOnly = true;
        }
Пример #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = -1;
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("SOCORRO.sp_mostrar_mis_cupones", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@user_id", usuActivo.id);
            command.ExecuteNonQuery();
            SqlDataAdapter adapter1 = new SqlDataAdapter();
            DataTable      table1   = new DataTable();

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
        }
Пример #10
0
        public static void filtros_clientes(DataGridView grid, string filtroNombre, string filtroApellido, int filtroDNI, string filtroemail, SqlDataAdapter adapter1, DataTable table1)
        {
            SqlConnection conn    = DBConnection.getConnection();
            SqlCommand    comando = new SqlCommand("SOCORRO.sp_buscar_clientes", conn);

            comando.CommandType = CommandType.StoredProcedure;

            comando.Parameters.AddWithValue("@apellido", filtroApellido);
            comando.Parameters.AddWithValue("@email", filtroemail);
            comando.Parameters.AddWithValue("@dni", filtroDNI);
            comando.Parameters.AddWithValue("@nombre", filtroNombre);

            DBConnection.fill_grid(grid, comando, adapter1, table1);
            comando.Dispose();
            conn.Close();
            conn.Dispose();
        }
Пример #11
0
        private void EstadoUsuarios_Load(object sender, EventArgs e)
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("select * from SOCORRO.Usuario", conexion);

            command.CommandType = CommandType.Text;

            adapter1 = new SqlDataAdapter();
            table1   = new DataTable();

            adapter1.UpdateCommand             = new SqlCommand("SOCORRO.sp_modificar_usuario", conexion);
            adapter1.UpdateCommand.CommandType = CommandType.StoredProcedure;
            SqlParameter parametro1 = new SqlParameter();

            parametro1.ParameterName = "@user_id";
            parametro1.SqlDbType     = SqlDbType.Int;
            parametro1.SourceVersion = DataRowVersion.Original;
            parametro1.SourceColumn  = "user_id";
            adapter1.UpdateCommand.Parameters.Add(parametro1);
            SqlParameter parametro2 = new SqlParameter();

            parametro2.ParameterName = "@user_username";
            parametro2.SourceColumn  = "user_username";
            adapter1.UpdateCommand.Parameters.Add(parametro2);
            SqlParameter parametro3 = new SqlParameter();

            parametro3.ParameterName = "@user_pass";
            parametro3.SourceColumn  = "user_pass";
            adapter1.UpdateCommand.Parameters.Add(parametro3);
            SqlParameter parametro4 = new SqlParameter();

            parametro4.ParameterName = "@user_intentos";
            parametro4.SourceColumn  = "user_intentos";
            adapter1.UpdateCommand.Parameters.Add(parametro4);
            SqlParameter parametro5 = new SqlParameter();

            parametro5.ParameterName = "@user_habilitado";
            parametro5.SourceColumn  = "user_habilitado";
            adapter1.UpdateCommand.Parameters.Add(parametro5);

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
            dataGridView1.Columns["user_id"].ReadOnly       = true;
            dataGridView1.Columns["user_pass"].ReadOnly     = true;
            dataGridView1.Columns["user_username"].ReadOnly = true;
        }
Пример #12
0
        public static void filtros_proveedores(DataGridView grid, string razonSocial, string cuit, string email, SqlDataAdapter adapter1, DataTable table1)
        {
            SqlConnection conn    = DBConnection.getConnection();
            SqlCommand    comando = new SqlCommand("SOCORRO.sp_buscar_proveedores", conn);

            comando.CommandType = CommandType.StoredProcedure;

            comando.Parameters.AddWithValue("@rs", razonSocial);
            comando.Parameters.AddWithValue("@cuit", cuit);
            comando.Parameters.AddWithValue("@mail", email);

            adapter1 = new SqlDataAdapter();
            table1   = new DataTable();
            DBConnection.fill_grid(grid, comando, adapter1, table1);
            comando.Dispose();
            conn.Close();
            conn.Dispose();
        }
Пример #13
0
        public void mostrar_items(int prov_id)
        {
            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("SELECT cupon_ofer_id, ofer_descripcion, COUNT(cupon_ofer_id) cantidad, ofer_precio_oferta, (ofer_precio_oferta*COUNT(cupon_ofer_id)) precioxcantidad FROM SOCORRO.Cupon cup JOIN SOCORRO.Oferta o ON o.ofer_id = cup.cupon_ofer_id where ofer_prov_id = @prov_id and @fecha_desde < cupon_fecha_compra and cupon_fecha_compra<@fecha_hasta group by cupon_ofer_id, ofer_descripcion,ofer_precio_oferta order by cantidad desc", conexion);

            command.CommandType = CommandType.Text;
            command.Parameters.AddWithValue("@prov_id", prov_id);
            dateTimePicker1.Value = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, 0, 0, 0);
            dateTimePicker2.Value = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month, dateTimePicker2.Value.Day, 23, 59, 59);
            command.Parameters.AddWithValue("@fecha_desde", dateTimePicker1.Value);
            command.Parameters.AddWithValue("@fecha_hasta", dateTimePicker2.Value);
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(command);

            DBConnection.fill_grid(dataGridView1, command, da, dt);
            dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;


            command.ExecuteReader();
            command.Dispose();
            conexion.Close();
            conexion.Dispose();
        }
Пример #14
0
        private void btn_mayorFactr_Click(object sender, EventArgs e)
        {
            if (!utils.validarEntradaSoloNumeros(textBox1) || !utils.validarNoVacio(textBox1) || textBox1.Text.Length != 4)
            {
                MessageBox.Show("Hubo un error con la entrada del año ");
                return;
            }


            SqlConnection conexion = DBConnection.getConnection();
            SqlCommand    command  = new SqlCommand("SOCORRO.sp_lista_prov_mayor_facturacion", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@semestre", comboBox1.SelectedIndex + 1);
            command.Parameters.AddWithValue("@anio", Convert.ToInt16(textBox1.Text));

            DBConnection.fill_grid(dataGridView1, command, adapter1, table1);
            adapter1.Dispose();
            table1   = new DataTable();
            adapter1 = new SqlDataAdapter();
            conexion.Close();
            conexion.Dispose();
        }