예제 #1
0
    public static List <Actor> getActors()
    {
        List <Actor> categoryList = new List <Actor>();
        //SqlConnection connection = new SqlConnection(GetConnectionString());
        SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
        string        sel        = "execute usp_selectActor";
        SqlCommand    cmd        = new SqlCommand(sel, connection);

        connection.Open();
        SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        Actor         actor;

        while (dr.Read())
        {
            actor        = new Actor();
            actor.StarID = dr["StarID"].ToString();
            actor.LName  = dr["LName"].ToString();
            actor.FName  = dr["FName"].ToString();
            categoryList.Add(actor);

            /*
             * //course.CategoryID = dr["ICategoryID"].ToString();
             * //course.ShortName = dr["IShortName"].ToString();
             * //course.LongName = dr["LongName"].ToString();
             * categoryList.Add(Faculty);
             */
        }
        dr.Close();
        return(categoryList);
    }
예제 #2
0
    public static List <Club> getClubs()
    {
        List <Club> categoryList = new List <Club>();
        //SqlConnection connection = new SqlConnection(GetConnectionString());
        SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
        string        sel        = "execute usp_selectClub";
        SqlCommand    cmd        = new SqlCommand(sel, connection);

        connection.Open();
        SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        Club          club;

        while (dr.Read())
        {
            club                 = new Club();
            club.ClubID          = dr["ClubID"].ToString();
            club.OrgID           = dr["OrgID"].ToString();
            club.ClubDescription = dr["ClubDescription"].ToString();
            categoryList.Add(club);

            /*
             * //course.CategoryID = dr["ICategoryID"].ToString();
             * //course.ShortName = dr["IShortName"].ToString();
             * //course.LongName = dr["LongName"].ToString();
             * categoryList.Add(Faculty);
             */
        }
        dr.Close();
        return(categoryList);
    }
예제 #3
0
    public static List <Organization> getOrganizations()
    {
        List <Organization> categoryList = new List <Organization>();
        //SqlConnection connection = new SqlConnection(GetConnectionString());
        SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
        string        sel        = "execute usp_selectOrganization";
        SqlCommand    cmd        = new SqlCommand(sel, connection);

        connection.Open();
        SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        Organization  org;

        while (dr.Read())
        {
            org                = new Organization();
            org.OrgID          = dr["OrgID"].ToString();
            org.OrgDescription = dr["OrgDescription"].ToString();
            categoryList.Add(org);

            /*
             * //course.CategoryID = dr["ICategoryID"].ToString();
             * //course.ShortName = dr["IShortName"].ToString();
             * //course.LongName = dr["LongName"].ToString();
             * categoryList.Add(Faculty);
             */
        }
        dr.Close();
        return(categoryList);
    }
예제 #4
0
    public static List <Member> getMembers()
    {
        List <Member> categoryList = new List <Member>();
        //SqlConnection connection = new SqlConnection(GetConnectionString());
        SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
        string        sel        = "execute usp_selectMember";
        SqlCommand    cmd        = new SqlCommand(sel, connection);

        connection.Open();
        SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        Member        member;

        while (dr.Read())
        {
            member          = new Member();
            member.MemberID = dr["MemberID"].ToString();
            member.LName    = dr["LName"].ToString();
            member.FName    = dr["FName"].ToString();
            member.Here     = Convert.ToBoolean(dr["Here"].ToString());
            categoryList.Add(member);

            /*
             * //course.CategoryID = dr["ICategoryID"].ToString();
             * //course.ShortName = dr["IShortName"].ToString();
             * //course.LongName = dr["LongName"].ToString();
             * categoryList.Add(Faculty);
             */
        }
        dr.Close();
        return(categoryList);
    }
예제 #5
0
        protected void rebuildBtn_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
            string        sel        = "usp_rebuildAll";
            SqlCommand    cmd        = new SqlCommand(sel, connection);

            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                connection.Open();
                cmd.ExecuteNonQuery();
                connection.Close();
                resultLbl.Text = "Rebuilding successful.";
            }
            catch (Exception exp)
            {
                resultLbl.Text = "Rebuilding failed.";
            }
        }
예제 #6
0
        public static Tuple <String, String> getColors(String OrgName)
        {
            SqlConnection connection = new SqlConnection(ConnectStringGenerator.getConnectString());
            string        sel        = "execute usp_getColors '" + OrgName + "'";
            SqlCommand    cmd        = new SqlCommand(sel, connection);

            connection.Open();
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            String Color1 = "";
            String Color2 = "";

            while (dr.Read())
            {
                Color1 = dr["Color1"].ToString();
                Color2 = dr["Color2"].ToString();
            }

            return(new Tuple <string, string>(Color1, Color2));
        }