Beispiel #1
0
 public int bajaDepartamento(Depto d)
 {
     Command.CommandText = "update departamentos set estatus = 0 where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", d.id);
     return Command.ExecuteNonQuery();
 }
Beispiel #2
0
 public int bajaDepartamento(Depto d)
 {
     Command.CommandText = "update departamentos set estatus = @estatus where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", d.id);
     Command.Parameters.AddWithValue("estatus", d.estatus);
     return(Command.ExecuteNonQuery());
 }
Beispiel #3
0
 public int actualizaDepartamento(Depto d)
 {
     Command.CommandText = "update departamentos set descripcion = @descripcion where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", d.id);
     Command.Parameters.AddWithValue("descripcion", d.descripcion);
     return(Command.ExecuteNonQuery());
 }
Beispiel #4
0
 public int insertaDepartamento(Depto d)
 {
     Command.CommandText = "insert into departamentos (descripcion, estatus) values (@descripcion, @estatus)";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("descripcion", d.descripcion);
     Command.Parameters.AddWithValue("estatus", d.estatus);
     return(Command.ExecuteNonQuery());
 }
Beispiel #5
0
 public int actualizaDepartamento(Depto d)
 {
     Command.CommandText = "update departamentos set descripcion = @descripcion where id = @id";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("id", d.id);
     Command.Parameters.AddWithValue("descripcion", d.descripcion);
     return Command.ExecuteNonQuery();
 }
Beispiel #6
0
 public int insertaDepartamento(Depto d)
 {
     Command.CommandText = "insert into departamentos (descripcion, estatus, idempresa) values (@descripcion, @estatus, @idempresa)";
     Command.Parameters.Clear();
     Command.Parameters.AddWithValue("descripcion", d.descripcion);
     Command.Parameters.AddWithValue("estatus", d.estatus);
     Command.Parameters.AddWithValue("idempresa", d.idempresa);
     return Command.ExecuteNonQuery();
 }
Beispiel #7
0
        public List <Depto> obtenerDepartamentos()
        {
            DataTable    dtDeptos  = new DataTable();
            List <Depto> lstDeptos = new List <Depto>();

            Command.CommandText = "select id, descripcion from departamentos where estatus = 1";
            Command.Parameters.Clear();
            dtDeptos = SelectData(Command);
            for (int i = 0; i < dtDeptos.Rows.Count; i++)
            {
                Depto d = new Depto();
                d.id          = int.Parse(dtDeptos.Rows[i]["id"].ToString());
                d.descripcion = dtDeptos.Rows[i]["descripcion"].ToString();
                lstDeptos.Add(d);
            }

            return(lstDeptos);
        }
Beispiel #8
0
        public List<Depto> obtenerDepartamentos(Depto depto)
        {
            DataTable dtDeptos = new DataTable();
            List<Depto> lstDeptos = new List<Depto>();
            Command.CommandText = "select id, descripcion from departamentos where estatus = 1 and idempresa = @idempresa";
            Command.Parameters.Clear();
            Command.Parameters.AddWithValue("idempresa", depto.idempresa);
            dtDeptos = SelectData(Command);
            for (int i = 0; i < dtDeptos.Rows.Count; i++)
            {
                Depto d = new Depto();
                d.id = int.Parse(dtDeptos.Rows[i]["id"].ToString());
                d.descripcion = dtDeptos.Rows[i]["descripcion"].ToString();
                lstDeptos.Add(d);
            }

            return lstDeptos;
        }
Beispiel #9
0
        public List <Depto> obtenerDepartamento(Depto d)
        {
            DataTable    dtDepto  = new DataTable();
            List <Depto> lstDepto = new List <Depto>();

            Command.CommandText = "select id, descripcion from departamentos where id = @id";
            Command.Parameters.Clear();
            Command.Parameters.AddWithValue("id", d.id);
            dtDepto = SelectData(Command);
            for (int i = 0; i < dtDepto.Rows.Count; i++)
            {
                Depto depto = new Depto();
                depto.id          = int.Parse(dtDepto.Rows[i]["id"].ToString());
                depto.descripcion = dtDepto.Rows[i]["descripcion"].ToString();
                lstDepto.Add(depto);
            }

            return(lstDepto);
        }
Beispiel #10
0
        public List<Depto> obtenerDepartamentos(int idEmpresa, DateTime fecha, int tipoNomina)
        {
            DataTable dtDeptos = new DataTable();
            List<Depto> lstDeptos = new List<Depto>();
            Command.CommandText = @"select distinct pn.iddepartamento as id, depto.descripcion as descripcion from PagoNomina pn inner join Departamentos depto on
                pn.iddepartamento = depto.id where pn.idempresa = @idempresa
                and pn.fechainicio = @fecha and tiponomina = @tiponomina order by pn.iddepartamento asc";
            Command.Parameters.Clear();
            Command.Parameters.AddWithValue("idempresa", idEmpresa);
            Command.Parameters.AddWithValue("fecha", fecha);
            Command.Parameters.AddWithValue("tipoNomina", tipoNomina);
            dtDeptos = SelectData(Command);
            for (int i = 0; i < dtDeptos.Rows.Count; i++)
            {
                Depto d = new Depto();
                d.id = int.Parse(dtDeptos.Rows[i]["id"].ToString());
                d.descripcion = dtDeptos.Rows[i]["descripcion"].ToString();
                lstDeptos.Add(d);
            }

            return lstDeptos;
        }