示例#1
0
        private SqlDataReader filtrar()
        {
            var        connection = DBConnection.getInstance().getConnection();
            SqlCommand command    = new SqlCommand("POSTRESQL.filtrarEmpresas", connection);

            command.CommandType = CommandType.StoredProcedure;


            command.Parameters.Add(new SqlParameter("@empr_nombre", txtNombre.Text));
            command.Parameters.Add(new SqlParameter("@empr_cuit", txtCuit.Text));
            if (comboBoxRubro.SelectedIndex > -1)
            {
                Rubro rubro = (Rubro)(this.comboBoxRubro.SelectedItem);
                command.Parameters.Add(new SqlParameter("@empr_rubro", Convert.ToInt32(rubro.code)));
            }
            else
            {
                command.Parameters.Add(new SqlParameter("@empr_rubro", Convert.ToInt32(0)));
            }
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            return(reader);
        }
        private List <Rubro> get_rubros_from_grid()
        {
            List <Rubro> rubros = new List <Rubro>();

            foreach (DataGridViewRow row in dgdRubros.Rows)
            {
                int    rubro_id          = int.Parse(row.Cells[0].Value.ToString());
                string rubro_descripcion = row.Cells[1].Value.ToString();

                Rubro rubro = new Rubro(rubro_id, rubro_descripcion);
                rubros.Add(rubro);
            }
            return(rubros);
        }
示例#3
0
 public ModificarEmpresa(Int16 id, Rubro rubro, String cuit, String nombre, String direccion, bool habilitado)
 {
     InitializeComponent();
     this.id         = id;
     this.rubro      = rubro;
     this.cuit       = cuit;
     this.nombre     = nombre;
     this.direccion  = direccion;
     this.habilitado = habilitado;
     if (habilitado)
     {
         checkBox1.Checked = true;
     }
     fill_rubro_combo(rubro);
 }
示例#4
0
        private void altaEmpresa()
        {
            var        connection = DBConnection.getInstance().getConnection();
            SqlCommand query      = new SqlCommand("POSTRESQL.altaEmpresa", connection);

            query.CommandType = CommandType.StoredProcedure;
            query.Parameters.Add(new SqlParameter("@empr_nombre", this.txtNombre.Text));
            query.Parameters.Add(new SqlParameter("@empr_cuit", this.txtCuit.Text));
            query.Parameters.Add(new SqlParameter("@empr_direccion", this.txtDireccion.Text));
            Rubro rubro = (Rubro)(this.comboBoxRubro.SelectedItem);

            query.Parameters.Add(new SqlParameter("@empr_rubro", Convert.ToInt32(rubro.code)));
            connection.Open();
            query.ExecuteNonQuery();
            connection.Close();
        }
示例#5
0
        private ModificadoEmpresa seleccionarEmpresa()
        {
            AbmEmpresa.ModificadoEmpresa modificar = new ModificadoEmpresa();
            Int16  id            = Convert.ToInt16(dataGridView1.SelectedRows[0].Cells[0].Value);
            String nombre        = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            String cuit          = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
            String direccion     = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
            Int16  rubro_id      = Convert.ToInt16(dataGridView1.SelectedRows[0].Cells[4].Value.ToString());
            String rubro_detalle = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
            bool   habilitado    = (bool)dataGridView1.SelectedRows[0].Cells[6].Value;
            Rubro  rubro         = new Rubro(rubro_id, rubro_detalle);

            modificar.id         = id;
            modificar.cuit       = cuit;
            modificar.direccion  = direccion;
            modificar.nombre     = nombre;
            modificar.rubro      = rubro;
            modificar.habilitado = habilitado;
            return(modificar);
        }
示例#6
0
        private void modificarEmpresa()
        {
            var        connection = DBConnection.getInstance().getConnection();
            SqlCommand query      = new SqlCommand("POSTRESQL.modificarEmpresa", connection);

            query.CommandType = CommandType.StoredProcedure;
            query.Parameters.Add(new SqlParameter("@empr_id", id));
            query.Parameters.Add(new SqlParameter("@empr_nombre", this.txtNombre.Text));
            query.Parameters.Add(new SqlParameter("@empr_cuit", this.txtCuit.Text));
            query.Parameters.Add(new SqlParameter("@empr_direccion", this.txtDireccion.Text));
            Rubro rubro = (Rubro)(this.comboBoxRubro.SelectedItem);

            query.Parameters.Add(new SqlParameter("@empr_rubro", Convert.ToInt32(rubro.code)));
            bool habilitado = false;

            if (checkBox1.Checked)
            {
                habilitado = true;
            }
            query.Parameters.Add(new SqlParameter("@empr_habilitado", habilitado));
            connection.Open();
            query.ExecuteNonQuery();
            connection.Close();
        }