コード例 #1
0
        public bool IngresarGrupoTrabajo(clsDetalleGrupoTrabajo grupotrabajo)
        {
            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

            builder.Server   = "localhost";
            builder.Port     = 3306;
            builder.UserID   = "root";
            builder.Password = "******";
            builder.SslMode  = MySqlSslMode.None;
            builder.Database = "dbcoordinacion";

            MySqlConnection con = new MySqlConnection(builder.ToString());

            MySqlCommand cmd = new MySqlCommand("insert into tbl_GrupoTrabajo(nombre_grupotrabajo,numero_grupotrabajo)" +
                                                "values(@nombregrupo,@numerogrupo)", con);

            cmd.Parameters.Add("@nombregrupo", MySqlDbType.VarChar).Value = grupotrabajo.Nombregrupotrabajo;
            cmd.Parameters.Add("@numerogrupo", MySqlDbType.Int32).Value   = grupotrabajo.Numerogrupotrabajo;

            con.Open();

            int exito = cmd.ExecuteNonQuery();

            if (exito == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public bool IngresarChoferGrupoTrabajo(clsDetalleGrupoTrabajo grupotrabajo)
        {
            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

            builder.Server   = "localhost";
            builder.Port     = 3306;
            builder.UserID   = "root";
            builder.Password = "******";
            builder.SslMode  = MySqlSslMode.None;
            builder.Database = "dbcoordinacion";

            MySqlConnection con = new MySqlConnection(builder.ToString());

            MySqlCommand cmd = new MySqlCommand("insert into tbl_DetalleGrupoTrabajo(tbl_GrupoTrabajo_id,tbl_IntegranteGrupo_id,tbl_TipoIntegranteGrupo_id)" +
                                                "values(@grupoid,@integrantegrupoid,@tipointegranteid)", con);


            cmd.Parameters.Add("@grupoid", MySqlDbType.Int32).Value           = grupotrabajo.Idgrupotrabajo;
            cmd.Parameters.Add("@integrantegrupoid", MySqlDbType.Int32).Value = grupotrabajo.Idintegrantegrupo;
            cmd.Parameters.AddWithValue("@tipointegranteid", 4);

            con.Open();

            int exito = cmd.ExecuteNonQuery();

            if (exito == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public List <clsDetalleGrupoTrabajo> ListarGruposTrabajo(string nombregrupo)
        {
            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

            builder.Server   = "localhost";
            builder.Port     = 3306;
            builder.UserID   = "root";
            builder.Password = "******";
            builder.SslMode  = MySqlSslMode.None;
            builder.Database = "dbcoordinacion";

            MySqlConnection con = new MySqlConnection(builder.ToString());

            MySqlCommand cmd = new MySqlCommand("SELECT nombre_grupotrabajo,numero_grupotrabajo,nombre_integrantegrupo,cargo_tipointegrante FROM tbl_DetalleGrupoTrabajo LEFT JOIN tbl_IntegranteGrupo ON tbl_DetalleGrupoTrabajo.tbl_IntegranteGrupo_id = tbl_IntegranteGrupo.idtbl_IntegranteGrupo LEFT JOIN tbl_TipoIntegranteGrupo ON tbl_IntegranteGrupo.tbl_TipoIntegranteGrupo_id = tbl_TipoIntegranteGrupo.idtbl_TipoIntegranteGrupo AND tbl_DetalleGrupoTrabajo.tbl_TipoIntegranteGrupo_id = tbl_TipoIntegranteGrupo.idtbl_TipoIntegranteGrupo AND nombre_grupotrabajo =" + nombregrupo, con);

            List <clsDetalleGrupoTrabajo> listagrupotrabajo = new List <clsDetalleGrupoTrabajo>();


            con.Open();


            MySqlDataReader lector = cmd.ExecuteReader();

            while (lector.Read())
            {
                clsDetalleGrupoTrabajo grupotrabajo = new clsDetalleGrupoTrabajo();
                clsIntegranteGrupo     integrante   = new clsIntegranteGrupo();

                grupotrabajo.Nombregrupotrabajo  = lector.GetString(0);
                grupotrabajo.Numerogrupotrabajo  = lector.GetInt32(1);
                integrante.Nombreintegrantegrupo = lector.GetString(2);
                integrante.Cargotipointegrante   = lector.GetString(3);


                listagrupotrabajo.Add(grupotrabajo);
            }


            con.Close();

            return(listagrupotrabajo);
        }
        public bool IngresarGrupoTrabajo(clsDetalleGrupoTrabajo grupotrabajo)
        {
            MySqlConnection con = new MySqlConnection(cadenaConexion);
            MySqlCommand    cmd = new MySqlCommand("insert into tbl_DetalleGrupoTrabajo(idtbl_DetalleGrupoTrabajo,tbl_IntegranteGrupo_id,tbl_TipoIntegranteGrupo_id)" +
                                                   "values(@grupotrabajoid,@integrantegrupoid,@tipointegranteid)", con);

            cmd.Parameters.Add("@grupotrabajoid", MySqlDbType.Int32).Value = grupotrabajo.Idgrupotrabajo;

            cmd.Parameters.Add("@integrantegrupoid", MySqlDbType.Int32).Value = grupotrabajo.Idintegrantegrupo;
            cmd.Parameters.Add("@tipointegranteid", MySqlDbType.Int32).Value  = grupotrabajo.Idtipointegrante;

            con.Open();

            int exito = cmd.ExecuteNonQuery();

            if (exito == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public List <clsDetalleGrupoTrabajo> ListarGruposTrabajo()
        {
            MySqlConnection con = new MySqlConnection(cadenaConexion);
            MySqlCommand    cmd = new MySqlCommand("select * from tbl_DetalleGrupoTrabajo", con);

            List <clsDetalleGrupoTrabajo> listagrupotrabajo = new List <clsDetalleGrupoTrabajo>();

            con.Open();
            MySqlDataReader lector = cmd.ExecuteReader();

            while (lector.Read())
            {
                clsDetalleGrupoTrabajo grupotrabajo = new clsDetalleGrupoTrabajo();

                grupotrabajo.Idgrupotrabajo    = lector.GetInt32(0);
                grupotrabajo.Idintegrantegrupo = lector.GetInt32(1);

                listagrupotrabajo.Add(grupotrabajo);
            }

            con.Close();

            return(listagrupotrabajo);
        }