Exemplo n.º 1
0
        public HT_Vai_Tro_Du_An_Chi_Tiet Lay(int Ma_Vai_Tro_Du_An)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("HT_Vai_Tro_Du_An_Lay", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pMa_Vai_Tro_Du_An = new SqlParameter("@Ma_Vai_Tro_Du_An", SqlDbType.Int, 4);
                    pMa_Vai_Tro_Du_An.Value = Ma_Vai_Tro_Du_An;
                    myCommand.Parameters.Add(pMa_Vai_Tro_Du_An);

                    SqlParameter pMa_Vai_Tro = new SqlParameter("@Ma_Vai_Tro", SqlDbType.Int, 4);
                    pMa_Vai_Tro.Direction = ParameterDirection.Output;
                    myCommand.Parameters.Add(pMa_Vai_Tro);

                    SqlParameter pMa_Du_An = new SqlParameter("@Ma_Du_An", SqlDbType.VarChar, 2);
                    pMa_Du_An.Direction = ParameterDirection.Output;
                    myCommand.Parameters.Add(pMa_Du_An);


                    myConnection.Open();
                    myCommand.ExecuteNonQuery();


                    HT_Vai_Tro_Du_An_Chi_Tiet myHT_Vai_Tro_Du_An_Chi_Tiet = new HT_Vai_Tro_Du_An_Chi_Tiet();
                    myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Vai_Tro_Du_An = Ma_Vai_Tro_Du_An;
                    myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Vai_Tro       = (int)pMa_Vai_Tro.Value;
                    myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Du_An         = (string)pMa_Du_An.Value;
                    return(myHT_Vai_Tro_Du_An_Chi_Tiet);
                }
            }
        }
Exemplo n.º 2
0
        public void Cap_Nhat(HT_Vai_Tro_Du_An_Chi_Tiet myHT_Vai_Tro_Du_An_Chi_Tiet)
        {
            using (SqlConnection myConnection = new SqlConnection(ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("HT_Vai_Tro_Du_An_Cap_Nhat", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    SqlParameter pMa_Vai_Tro_Du_An = new SqlParameter("@Ma_Vai_Tro_Du_An", SqlDbType.Int, 4);
                    pMa_Vai_Tro_Du_An.Value = myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Vai_Tro_Du_An;
                    myCommand.Parameters.Add(pMa_Vai_Tro_Du_An);

                    SqlParameter pMa_Vai_Tro = new SqlParameter("@Ma_Vai_Tro", SqlDbType.Int, 4);
                    pMa_Vai_Tro.Value = myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Vai_Tro;
                    myCommand.Parameters.Add(pMa_Vai_Tro);

                    SqlParameter pMa_Du_An = new SqlParameter("@Ma_Du_An", SqlDbType.VarChar, 2);
                    pMa_Du_An.Value = myHT_Vai_Tro_Du_An_Chi_Tiet.Ma_Du_An;
                    myCommand.Parameters.Add(pMa_Du_An);


                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                }
            }
        }