Пример #1
0
        public IList<Core.Business.Activities> GetAllActivities()
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

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

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    if (!reader.IsDBNull(11)) activities.IsCheck = reader.GetBoolean(11);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #2
0
        public IList<Activities> GetUnCheck()
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            string sqlwhere = " [IsCheck] ='false' ";
            sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, sqlwhere);
            sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, "Id desc");
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectActivitiesDynamic");

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    if (!reader.IsDBNull(11)) activities.IsCheck = reader.GetBoolean(11);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #3
0
        public IList<Activities> GetOtherFollowActive(int aid, Core.PagingInfo pageinfo)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlwhere = string.Empty;

            StringBuilder strb = new StringBuilder();
            strb.Append("declare @LowerBand int declare @UpperBand int declare @CurrentPage int declare @PageSize int");
            strb.Append(" Set @CurrentPage=" + pageinfo.CurrentPage + " Set @PageSize=" + pageinfo.PageSize + "");
            strb.Append(" SET @LowerBand  = (@CurrentPage - 1) * @PageSize");
            strb.Append(" SET @UpperBand  = (@CurrentPage * @PageSize) + 1");
            strb.Append(" ;WITH tempPagedUsers AS(");
            strb.Append(" select c.Id,ROW_NUMBER() over(order by c.EndTime desc) as RowNumber from Activities c inner join(select a.ActivitieId as Id  from ActivitieParticipants a inner join ");
            strb.Append("( select AccountId from ActivitieParticipants where ActivitieId=" + aid + " group by AccountId) b on a.AccountId=b.AccountId where [ActivitieId]<>" + aid + "  group by a.ActivitieId )d on c.Id=d.Id where c.[IsCheck]='true'");
            strb.Append(") SELECT * FROM tempPagedUsers WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand");

            SqlDataReader reader = sql.ExecuteSqlReader(strb.ToString());

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);

                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #4
0
        public IList<Activities> GetOtherFollowActive(int aid, int num)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlwhere = "select top " + num + " c.Id from Activities c inner join(select a.ActivitieId as Id  from ActivitieParticipants a inner join ( select AccountId from ActivitieParticipants where ActivitieId=" + aid + " group by AccountId) b on a.AccountId=b.AccountId where [ActivitieId]<>" + aid + " group by a.ActivitieId )d on c.Id=d.Id where c.[IsCheck]='true' order by newid()";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    if (!reader.IsDBNull(0)) activities = CY.UME.Core.Business.Activities.Load(reader.GetInt32(0));//֮ǰֻ������Id

                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #5
0
        /// <summary>
        ///�ҵ�С�鷢��Ļ (ǰ4��)
        /// </summary>
        /// <param name="curID"></param>
        /// <returns></returns>
        public IList<Activities> GetMyGroupTop4(List<CY.UME.Core.Business.Group> groupList, long aid)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlTemp = "Select top 4 Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address From Activities";
            string sqlwhere = string.Empty;
            if (groupList != null && groupList.Count > 0)
            {
                sqlwhere = " where IsCheck='true' and (";
                for (int i = 0; i < groupList.Count; i++)
                {
                    //ȡ��ÿ��Ⱥ���е�������
                    CY.UME.Core.PagingInfo paginfo = new CY.UME.Core.PagingInfo { PageSize = int.MaxValue, CurrentPage = 1 };
                    IList<CY.UME.Core.Business.Account> accountList = CY.UME.Core.Business.Account.GetAllAccountByGroupId(groupList[i].Id, paginfo);
                    for (int a = 0; a < accountList.Count; a++)
                    {
                        if (accountList[a].Id != aid)
                        {
                            sqlwhere += " Sponsor=" + accountList[a].Id + " or ";
                        }
                    }
                }
                sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 3);
                sqlwhere += ")";
            }

            string sqlT = sqlTemp + sqlwhere + " order by [Id] desc";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlT);

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #6
0
        public IList<Activities> GetMyGroupCheck(List<Group> groupList, Core.PagingInfo pageinfo, long aid)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            //string sqlTemp = "Select Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address From Activities";
            string sqlwhere = string.Empty;
            if (groupList != null && groupList.Count > 0)
            {
                sqlwhere = " (";
                for (int i = 0; i < groupList.Count; i++)
                {
                    //ȡ��ÿ��Ⱥ���е�������
                    CY.UME.Core.PagingInfo paginfo = new CY.UME.Core.PagingInfo { PageSize = int.MaxValue, CurrentPage = 1 };
                    IList<CY.UME.Core.Business.Account> accountList = CY.UME.Core.Business.Account.GetAllAccountByGroupId(groupList[i].Id, paginfo);
                    for (int a = 0; a < accountList.Count; a++)
                    {
                        if (accountList[a].Id != aid)
                        {
                            sqlwhere += " Sponsor=" + accountList[a].Id + " or";
                        }
                    }
                }
                sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 3);
                sqlwhere += ")";
            }

            //string sqlT = sqlTemp + sqlwhere + " order by [Id] desc";

            //SqlDataReader reader = sql.ExecuteSqlReader(sqlT);

            #region ����

            //string tables = "Activities";
            //string pK = "Id";
            //string sort = "Id desc";
            //int pageNum = pageinfo.CurrentPage;
            //int pageSize = pageinfo.PageSize;
            //string filter = sqlwhere + " and IsCheck='true' ";
            //string fields = "Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address";
            //string group = "";
            //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");
            #endregion

            StringBuilder strb = new StringBuilder();
            strb.Append("declare @LowerBand int declare @UpperBand int declare @CurrentPage int declare @PageSize int");
            strb.Append(" Set @CurrentPage=" + pageinfo.CurrentPage + " Set @PageSize=" + pageinfo.PageSize + "");
            strb.Append(" SET @LowerBand  = (@CurrentPage - 1) * @PageSize");
            strb.Append(" SET @UpperBand  = (@CurrentPage * @PageSize) + 1");
            strb.Append(" ;WITH tempPagedUsers AS(Select Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address,ROW_NUMBER() over(order by Id desc) as RowNumber From Activities where");
            strb.Append(sqlwhere + " and IsCheck='true' )");
            strb.Append(" SELECT * FROM tempPagedUsers WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand");

            SqlDataReader reader = sql.ExecuteSqlReader(strb.ToString());
            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Activities activities = new Core.Business.Activities();

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #7
0
        public IList<Activities> GetAllCheck(Core.PagingInfo pageinfo)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            //string sqlwhere = "Select Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address From Activities where IsCheck='true' Order By Id DESC";
            #region ����

            string tables = "Activities";
            string pK = "Id";
            string sort = "Id Desc";
            int pageNum = pageinfo.CurrentPage;
            int pageSize = pageinfo.PageSize;
            string filter = "IsCheck='true'";
            string fields = "Id,[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address";
            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.Activities activities = new Core.Business.Activities();

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #8
0
        /// <summary>
        /// ���Ȼ��ǰ4����
        /// </summary>
        /// <returns></returns>
        public IList<Activities> GetHotTop4()
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            string sqlwhere = "Select top 4 a.Id,a.[Name],a.Organizer,a.StartTime,a.EndTime,a.Sponsor,a.Pic,a.Overview,a.Slogans,a.[Type],a.Address,gap.PCount From Activities a inner join (select count(ActivitieId) as PCount, ActivitieId From ActivitieParticipants where ([Type]=1 or [Type]=2) Group By ActivitieId) gap on gap.ActivitieId = a.Id and a.IsCheck='true' Order By gap.PCount DESC,a.EndTime desc";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    int id = reader.GetInt32(0);
                    activities = Core.Business.Activities.Load(id);

                    //if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    //if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    //if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    //if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    //if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    //if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    //if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    //if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    //if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    //if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    //if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    //if (!reader.IsDBNull(11)) activities.JoinMember = reader.GetInt32(11);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #9
0
        public IList<Activities> GetHotOrganizerCheck(Core.PagingInfo pageinfo)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            //string sqlwhere = "select count(Id) as PCount, Organizer from Activities where IsCheck='true' and Organizer!=0 group by Organizer";

            #region ����

            string tables = "Activities";
            string pK = "Organizer";
            string sort = "";
            int pageNum = pageinfo.CurrentPage;
            int pageSize = pageinfo.PageSize;
            string filter = " IsCheck='true' and Organizer!=0";
            string fields = " count(Id) as PCount ,Organizer ";
            string group = "Organizer";

            #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");

            //SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    if (!reader.IsDBNull(1)) activities.Organizer = reader.GetInt64(1);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #10
0
        /// <summary>
        /// ��ȡ�������췽ǰ4��
        /// </summary>
        /// <returns></returns>
        public IList<Activities> GetHotOrganizer()
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            string sqlwhere = "select top 4 count(Id) as PCount, Organizer from Activities where IsCheck='true' and Organizer!=0 group by Organizer";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    if (!reader.IsDBNull(1)) activities.Organizer = reader.GetInt64(1);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #11
0
        public IList<Activities> GetHotCheck(Core.PagingInfo pageinfo)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            //string sqlwhere = "Select a.Id,a.[Name],a.Organizer,a.StartTime,a.EndTime,a.Sponsor,a.Pic,a.Overview,a.Slogans,a.[Type],a.Address,gap.PCount From Activities a inner join (select count(ActivitieId) as PCount, ActivitieId From ActivitieParticipants where [Type]=1 Group By ActivitieId) gap on gap.ActivitieId = a.Id and a.IsCheck='true' Order By gap.PCount DESC";

            StringBuilder strb = new StringBuilder();
            strb.Append("declare @LowerBand int declare @UpperBand int declare @CurrentPage int declare @PageSize int");
            strb.Append(" Set @CurrentPage=" + pageinfo.CurrentPage + " Set @PageSize=" + pageinfo.PageSize + "");
            strb.Append(" SET @LowerBand  = (@CurrentPage - 1) * @PageSize");
            strb.Append(" SET @UpperBand  = (@CurrentPage * @PageSize) + 1");
            strb.Append(" ;WITH tempPagedUsers AS( Select a.Id,a.[Name],a.Organizer,a.StartTime,a.EndTime,a.Sponsor,a.Pic,a.Overview,a.Slogans,a.[Type],a.Address,gap.PCount,ROW_NUMBER() over(order by gap.PCount desc,a.EndTime desc) as RowNumber");
            strb.Append(" From Activities a inner join (select count(ActivitieId) as PCount, ActivitieId From ActivitieParticipants where ([Type]=1 or [Type]=2) ");
            strb.Append(" Group By ActivitieId) gap on gap.ActivitieId = a.Id and a.IsCheck='true' ) SELECT * FROM tempPagedUsers WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand ");

            SqlDataReader reader = sql.ExecuteSqlReader(strb.ToString());

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    if (!reader.IsDBNull(11)) activities.JoinMember = reader.GetInt32(11);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #12
0
        /// <summary>
        /// ���»��ǰ4����
        /// </summary>
        /// <returns></returns>
        public IList<Activities> GetAllTopNum(int PageSize)
        {
            IList<Core.Business.Activities> activitieslist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@PageSize", SqlDbType.Int, PageSize);
            string sqlwhere = "Select top (@PageSize) [Id],[Name],Organizer,StartTime,EndTime,Sponsor,Pic,Overview,Slogans,[Type],Address From Activities where IsCheck='true' Order By Id DESC";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    activities.MarkOld();
                    activitieslist.Add(activities);
                }
                reader.Close();
            }
            return activitieslist;
        }
Пример #13
0
        public Core.Business.Activities Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

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

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

                if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                if (!reader.IsDBNull(11)) activities.IsCheck = reader.GetBoolean(11);
                reader.Close();
                return activities;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        /// <summary>
        /// ǰ4��
        /// </summary>
        /// <param name="AccountId"></param>
        /// <returns></returns>
        public IList<Activities> GetListByAccountId(long AccountId)
        {
            IList<Core.Business.Activities> activitielist = new List<Core.Business.Activities>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sqlwhere = "select top 4 a.Id,a.[Name],a.Organizer,a.StartTime,a.EndTime,a.Sponsor,a.Pic,a.Overview,a.Slogans,a.[Type],a.Address from Activities a inner join(select * from ActivitieParticipants where ActivitieParticipants.Type=1) b on a.Id=b.ActivitieId and b.AccountID=" + AccountId + "";

            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                    if (!reader.IsDBNull(0)) activities.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) activities.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) activities.Organizer = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) activities.StartTime = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) activities.EndTime = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) activities.Sponsor = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) activities.Pic = reader.GetString(6);
                    if (!reader.IsDBNull(7)) activities.Overview = reader.GetString(7);
                    if (!reader.IsDBNull(8)) activities.Slogans = reader.GetString(8);
                    if (!reader.IsDBNull(9)) activities.Type = reader.GetInt32(9);
                    if (!reader.IsDBNull(10)) activities.Address = reader.GetString(10);
                    activities.MarkOld();

                    activities.MarkOld();
                    activitielist.Add(activities);
                }
                reader.Close();
            }
            return activitielist;
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CY.UME.Core.Business.Group group = new Core.Business.Group();
                CY.UME.Core.Business.Activities activities = new Core.Business.Activities();

                if (int.TryParse(Request.QueryString["activeID"], out activeId))
                {
                    activities = CY.UME.Core.Business.Activities.Load(activeId);
                }

                if (activities == null)
                {
                    if (group != null) LBLGroupName.Text = group.Name + "群组";//群组名称
                }
                else if (activities != null) LBLGroupName.Text = activities.Name + "活动";//活动名称

                if (Request.QueryString["topicId"] == null)
                {
                    if ((Request.QueryString["groupId"] == null || !int.TryParse(Request.QueryString["groupId"].ToString(), out groupId)) && activeId == 0)
                    {
                        throw new Exception("您所访问的页面不存在");
                    }

                    group = CY.UME.Core.Business.Group.Load(groupId);

                    if (group == null)
                    {
                        throw new Exception("您所访问的页面不存在");
                    }

                    uc_GroupInfo.group = group;
                    uc_NewestTopices.group = group;
                    HF_GroupId.Value = groupId.ToString();

                    SetTitle("发起话题");
                }
                else
                {
                    Guid topicId = Guid.Empty;
                    if (Request.QueryString["topicId"] == null)
                    {
                        throw new Exception("您所访问的页面不存在");
                    }

                    topicId = new Guid(Request.QueryString["topicId"]);
                    CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId);

                    if (topic == null)
                    {
                        throw new Exception("您所访问的页面不存在");
                    }

                    group = CY.UME.Core.Business.Group.GetGroupByTopicId(topicId.ToString());

                    uc_GroupInfo.group = group;
                    uc_NewestTopices.group = group;

                    if (!IsPostBack)
                    {
                        TBXTopicName.Text = topic.Title;
                        wysiwyg.Value = topic.Content;

                        HF_SiteUrl.Value = SiteUrl;

                        SetTitle("编辑话题");

                        HF_TopicId.Value = topicId.ToString();
                    }

                    ExecuteClientScript("$('#wysiwyg').focus();");

                    SetTitle("编辑话题");

                }
                //base.CSSName = "ume2";
            }
        }