public IList<Core.Business.ActivitieParticipants> GetAllActivitieParticipants()
        {
            IList<Core.Business.ActivitieParticipants> activitieParticipantslist = new List<Core.Business.ActivitieParticipants>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectActivitieParticipantsAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.ActivitieParticipants activitieParticipants = new Core.Business.ActivitieParticipants();

                    if (!reader.IsDBNull(0)) activitieParticipants.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activitieParticipants.ActivitieId = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) activitieParticipants.AccountId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activitieParticipants.JionTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activitieParticipants.Type = reader.GetInt32(4);
                    activitieParticipants.MarkOld();
                    activitieParticipantslist.Add(activitieParticipants);
                }
                reader.Close();
            }
            return activitieParticipantslist;
        }
Ejemplo n.º 2
0
        public IList<ActivitieParticipants> GetMyFriendLoveCheck(List<Account> myFriendList, Core.PagingInfo pageinfo)
        {
            IList<Core.Business.ActivitieParticipants> activitieslist = new List<Core.Business.ActivitieParticipants>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            //string sqlTemp = "Select distinct [ActivitieId] From ActivitieParticipants";
            string sqlwhere = string.Empty;
            if (myFriendList != null && myFriendList.Count > 0)
            {
                sqlwhere += "(AccountId in ( ";
                if (myFriendList.Count == 0)
                {
                    sqlwhere += " 1=1 ";
                }
                else
                {
                    for (int i = 0; i < myFriendList.Count; i++)
                    {
                        sqlwhere += myFriendList[i].Id + " , ";
                    }
                    sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 3);
                }
                sqlwhere += " ))";
            }

            //string sqlT = sqlTemp + sqlwhere + " and Type=1 ";
            //SqlDataReader reader = sql.ExecuteSqlReader(sqlT);

            #region ����

            string tables = "ActivitieParticipants";
            string pK = "ActivitieId";
            string sort = "ActivitieId desc";
            int pageNum = pageinfo.CurrentPage;
            int pageSize = pageinfo.PageSize;
            string filter = sqlwhere + " and Type=1";
            string fields = "distinct ActivitieId";
            string group = "";

            #endregion

            sql.AddParameter("@Tables", SqlDbType.VarChar, tables);
            sql.AddParameter("@PK", SqlDbType.VarChar, pK);
            sql.AddParameter("@Sort", SqlDbType.VarChar, sort);
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            sql.AddParameter("@Fields", SqlDbType.VarChar, fields);
            sql.AddParameter("@Group", SqlDbType.VarChar, group);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ActivitieParticipants activities = new Core.Business.ActivitieParticipants();

                    if (!reader.IsDBNull(0)) activities.ActivitieId = reader.GetInt32(0);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// �ҵĺ��ѲμӵĻ(ǰ4��)
        /// </summary>
        /// <param name="myFriendList"></param>
        /// <returns></returns>
        public IList<ActivitieParticipants> GetMyFriendLoveActiveList(List<Account> myFriendList)
        {
            IList<Core.Business.ActivitieParticipants> activitieslist = new List<Core.Business.ActivitieParticipants>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlTemp = "Select distinct [ActivitieId] From ActivitieParticipants";
            string sqlwhere = string.Empty;
            if (myFriendList != null && myFriendList.Count > 0)
            {
                sqlwhere += " where ( ";
                if (myFriendList.Count == 0)
                {
                    sqlwhere += " 1=1 ";
                }
                else
                {
                    for (int i = 0; i < myFriendList.Count; i++)
                    {
                        sqlwhere += " AccountId =" + myFriendList[i].Id + " or ";
                    }
                    sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 3);
                }
                sqlwhere += " ) ";
            }

            string sqlT = sqlTemp + sqlwhere + " and Type=1 ";
            SqlDataReader reader = sql.ExecuteSqlReader(sqlT);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ActivitieParticipants activities = new Core.Business.ActivitieParticipants();

                    if (!reader.IsDBNull(0)) activities.ActivitieId = reader.GetInt32(0);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
        public IList<ActivitieParticipants> GetByActiveIDandAccountID(int activeID, long accountID, int type)
        {
            IList<Core.Business.ActivitieParticipants> activitieParticipantslist = new List<Core.Business.ActivitieParticipants>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlwhere = "select [Id],[ActivitieId],[AccountId],[JionTime],[Type] from ActivitieParticipants where Type="+type+" and ActivitieId=" + activeID + " and [AccountId]="+accountID+"";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ActivitieParticipants activitieParticipants = new Core.Business.ActivitieParticipants();

                    if (!reader.IsDBNull(0)) activitieParticipants.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activitieParticipants.ActivitieId = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) activitieParticipants.AccountId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activitieParticipants.JionTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activitieParticipants.Type = reader.GetInt32(4);
                    activitieParticipants.MarkOld();
                    activitieParticipantslist.Add(activitieParticipants);
                }
                reader.Close();
            }
            return activitieParticipantslist;
        }
        public IList<ActivitieParticipants> GetByActiveID(int activeID, CY.UME.Core.PagingInfo pageinfo)
        {
            IList<Core.Business.ActivitieParticipants> activitieParticipantslist = new List<Core.Business.ActivitieParticipants>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            #region ����

            string tables = "ActivitieParticipants";
            string pK = "Id";
            string sort = "AccountId Desc";
            int pageNum = pageinfo.CurrentPage;
            int pageSize = pageinfo.PageSize;
            string filter = " ActivitieId=" + activeID + "";
            string fields = "distinct(AccountId)";
            string group = String.Empty;

            #endregion

            sql.AddParameter("@Tables", SqlDbType.VarChar, tables);
            sql.AddParameter("@PK", SqlDbType.VarChar, pK);
            sql.AddParameter("@Sort", SqlDbType.VarChar, sort);
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            sql.AddParameter("@Fields", SqlDbType.VarChar, fields);
            sql.AddParameter("@Group", SqlDbType.VarChar, group);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ActivitieParticipants activitieParticipants = new Core.Business.ActivitieParticipants();

                    if (!reader.IsDBNull(0)) activitieParticipants.AccountId = reader.GetInt64(0);

                    activitieParticipants.MarkOld();
                    activitieParticipantslist.Add(activitieParticipants);
                }
                reader.Close();
            }
            return activitieParticipantslist;
        }
        public Core.Business.ActivitieParticipants Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectActivitieParticipant");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.ActivitieParticipants activitieParticipants = new Core.Business.ActivitieParticipants();

                if (!reader.IsDBNull(0)) activitieParticipants.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) activitieParticipants.ActivitieId = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) activitieParticipants.AccountId = reader.GetInt64(2);
                if (!reader.IsDBNull(3)) activitieParticipants.JionTime = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) activitieParticipants.Type = reader.GetInt32(4);
                reader.Close();
                return activitieParticipants;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }