/// <summary>
 /// Copies the elements of the specified <see cref="Noticeinfo">Noticeinfo</see> array to the end of the collection.
 /// </summary>
 /// <param name="value">An array of type <see cref="Noticeinfo">Noticeinfo</see> containing the Components to add to the collection.</param>
 public void AddRange(NoticeInfo[] value)
 {
     for (int i = 0; (i < value.Length); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 添加指定的通知信息
 /// </summary>
 /// <param name="noticeinfo">要添加的通知信息</param>
 /// <returns></returns>
 public static int CreateNoticeInfo(NoticeInfo noticeinfo)
 {
     #if !DEBUG
     if (noticeinfo.Posterid == noticeinfo.Uid)
         return 0;
     #endif
     int olid = OnlineUsers.GetOlidByUid(noticeinfo.Uid);
     if (olid > 0)
     {
         OnlineUsers.UpdateNewNotices(olid, 1);
     }
     return SAS.Data.DataProvider.Notices.CreateNoticeInfo(noticeinfo);
 }
Esempio n. 3
0
 /// <summary>
 /// 添加指定的通知信息
 /// </summary>
 /// <param name="noticeInfo">要添加的通知信息</param>
 /// <returns></returns>
 public int CreateNoticeInfo(NoticeInfo noticeInfo)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4, noticeInfo.Uid),
                                 DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 4, noticeInfo.Type),
                                 DbHelper.MakeInParam("@new", (DbType)SqlDbType.Int, 4, noticeInfo.New),
                                 DbHelper.MakeInParam("@posterid", (DbType)SqlDbType.Int, 4, noticeInfo.Posterid),
                                 DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NChar, 20, noticeInfo.Poster),
                                 DbHelper.MakeInParam("@note", (DbType)SqlDbType.NText, 0, noticeInfo.Note),
                                 DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.DateTime, 8, noticeInfo.Postdatetime)
                             };
     return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.StoredProcedure,
                                                             string.Format("{0}createnotice", BaseConfigs.GetTablePrefix),
                                                             parms), -1);
 }
Esempio n. 4
0
 /// <summary>
 /// 更新指定的通知信息
 /// </summary>
 /// <param name="noticeInfo">要更新的通知信息</param>
 /// <returns></returns>
 public bool UpdateNoticeInfo(NoticeInfo noticeInfo)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@nid", (DbType)SqlDbType.Int, 4, noticeInfo.Nid),
                                 DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4, noticeInfo.Uid),
                                 DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 4, noticeInfo.Type),
                                 DbHelper.MakeInParam("@new", (DbType)SqlDbType.Int, 4, noticeInfo.New),
                                 DbHelper.MakeInParam("@posterid", (DbType)SqlDbType.Int, 4, noticeInfo.Posterid),
                                 DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NChar, 20, noticeInfo.Poster),
                                 DbHelper.MakeInParam("@note", (DbType)SqlDbType.NText, 0, noticeInfo.Note),
                                 DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.DateTime, 8, noticeInfo.Postdatetime)
                             };
     string commandText = string.Format("UPDATE [{0}notices] SET  [uid] = @uid, [nn_type] = @type, [new] = @new, [posterid] = @posterid, [poster] = @poster, [note] = @note, [postdatetime] = @postdatetime  WHERE [nid] = @nid",
                                         BaseConfigs.GetTablePrefix);
     return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms) > 0;
 }
Esempio n. 5
0
        /// <summary>
        /// 增加一个会员信息到在线列表中。用户login.aspx或在线用户信息超时,但用户仍在线的情况下重新生成用户在线列表
        /// </summary>
        /// <param name="uid"></param>
        private static OnlineUserInfo CreateUser(int uid, int timeout)
        {
            OnlineUserInfo onlineuserinfo = new OnlineUserInfo();
            if (uid > 0)
            {
                ShortUserInfo ui = Users.GetShortUserInfo(uid);
                if (ui != null)
                {
                    onlineuserinfo.Ol_ps_id = uid;
                    onlineuserinfo.Ol_name = ui.Ps_name.Trim();
                    onlineuserinfo.Ol_nickName = ui.Ps_nickName.Trim();
                    onlineuserinfo.Ol_password = ui.Ps_password.Trim();
                    onlineuserinfo.Ol_ug_id = short.Parse(ui.Ps_ug_id.ToString());
                    onlineuserinfo.Ol_img = GetGroupImg(short.Parse(ui.Ps_ug_id.ToString()));
                    onlineuserinfo.Ol_pg_id = short.Parse(ui.Ps_pg_id.ToString());
                    onlineuserinfo.Ol_invisible = short.Parse(ui.Ps_invisible.ToString());
                    onlineuserinfo.Ol_ip = SASRequest.GetIP();
                    onlineuserinfo.Ol_lastpostpmtime = "1900-1-1 00:00:00";
                    onlineuserinfo.Ol_lastsearchtime = "1900-1-1 00:00:00";
                    onlineuserinfo.Ol_lastupdatetime = "1900-1-1 00:00:00";
                    onlineuserinfo.Ol_action = 0;
                    onlineuserinfo.Ol_lastactivity = 0;
                    onlineuserinfo.Ol_verifycode = LogicUtils.CreateAuthStr(5, false);
                    onlineuserinfo.Ol_newpms = short.Parse(PrivateMessages.GetPrivateMessageCount(uid, 0, 1).ToString());
                    onlineuserinfo.Ol_newnotices = short.Parse(Notices.GetNewNoticeCountByUid(uid).ToString());
                    onlineuserinfo.Ol_id = SAS.Data.DataProvider.OnlineUsers.CreateOnlineUserInfo(onlineuserinfo, timeout);

                    //给管理人员发送关注通知
                    if (ui.Ps_pg_id > 0 && ui.Ps_pg_id < 4)
                    {
                        if (SAS.Data.DataProvider.Notices.ReNewNotice((int)Noticetype.AttentionNotice, ui.Ps_id) == 0)
                        {
                            NoticeInfo ni = new NoticeInfo();
                            ni.New = 1;
                            ni.Note = "请及时查看<a href=\"modcp.aspx?operation=attention&forumid=0\">需要关注的主题</a>";
                            ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            ni.Type = Noticetype.AttentionNotice;
                            ni.Poster = "";
                            ni.Posterid = 0;
                            ni.Uid = ui.Ps_id;
                            Notices.CreateNoticeInfo(ni);
                        }
                    }
                    SAS.Data.DataProvider.OnlineUsers.SetUserOnlineState(uid, 1);

                    HttpCookie cookie = HttpContext.Current.Request.Cookies["sas"];
                    if (cookie != null)
                    {
                        //cookie.Values["tpp"] = ui.Tpp.ToString();
                        //cookie.Values["ppp"] = ui.Ppp.ToString();
                        if (HttpContext.Current.Request.Cookies["sas"]["expires"] != null)
                        {
                            int expires = TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["sas"]["expires"].ToString(), 0);
                            if (expires > 0)
                            {
                                cookie.Expires = DateTime.Now.AddMinutes(TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["sas"]["expires"].ToString(), 0));
                            }
                        }
                    }

                    string cookieDomain = GeneralConfigs.GetConfig().CookieDomain.Trim();
                    if (!Utils.StrIsNullOrEmpty(cookieDomain) && HttpContext.Current.Request.Url.Host.IndexOf(cookieDomain) > -1 && LogicUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
                        cookie.Domain = cookieDomain;
                    HttpContext.Current.Response.AppendCookie(cookie);
                }
                else
                {
                    onlineuserinfo = CreateGuestUser(timeout);
                }
            }
            else
            {
                onlineuserinfo = CreateGuestUser(timeout);
            }

            return onlineuserinfo;
        }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="NoticeinfoCollection">NoticeinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="NoticeinfoCollection">NoticeinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(NoticeInfo value)
 {
     return this.List.Contains(value);
 }
 public int Add(NoticeInfo value)
 {
     return this.List.Add(value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NoticeinfoCollection">NoticeinfoCollection</see> class containing the specified array of <see cref="Noticeinfo">Noticeinfo</see> Components.
 /// </summary>
 /// <param name="value">An array of <see cref="Noticeinfo">Noticeinfo</see> Components with which to initialize the collection. </param>
 public NoticeinfoCollection(NoticeInfo[] value)
 {
     this.AddRange(value);
 }
 public void Remove(NoticeInfo value)
 {
     List.Remove(value);
 }
Esempio n. 10
0
 public void Insert(int index, NoticeInfo value)
 {
     List.Insert(index, value);
 }
Esempio n. 11
0
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="NoticeinfoCollection">NoticeinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="NoticeinfoCollection">NoticeinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(NoticeInfo value)
 {
     return this.List.IndexOf(value);
 }
Esempio n. 12
0
 /// <summary>
 /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
 /// <param name="index">The index of the array at which to begin inserting.</param>
 public void CopyTo(NoticeInfo[] array, int index)
 {
     this.List.CopyTo(array, index);
 }
Esempio n. 13
0
 private static NoticeInfo LoadSingleNoticeInfo(IDataReader reader)
 {
     NoticeInfo noticeinfo = new NoticeInfo();
     noticeinfo.Nid = TypeConverter.ObjectToInt(reader["nid"], 0);
     noticeinfo.Uid = TypeConverter.ObjectToInt(reader["uid"], 0);
     noticeinfo.Type = (Noticetype)TypeConverter.ObjectToInt(reader["type"], 0);
     noticeinfo.New = TypeConverter.ObjectToInt(reader["new"], 0);
     noticeinfo.Posterid = TypeConverter.ObjectToInt(reader["posterid"], 0);
     noticeinfo.Poster = reader["poster"].ToString().Trim();
     noticeinfo.Note = Utils.HtmlDecode(reader["note"].ToString());
     noticeinfo.Postdatetime = reader["postdatetime"].ToString();
     return noticeinfo;
 }
Esempio n. 14
0
 /// <summary>
 /// 添加指定的通知信息
 /// </summary>
 /// <param name="noticeinfo">要添加的通知信息</param>
 /// <returns></returns>
 public static int CreateNoticeInfo(NoticeInfo noticeinfo)
 {
     return DatabaseProvider.GetInstance().CreateNoticeInfo(noticeinfo);
 }
Esempio n. 15
0
 /// <summary>
 /// 更新指定的通知信息
 /// </summary>
 /// <param name="noticeinfo">要更新的通知信息</param>
 /// <returns></returns>
 public static bool UpdateNoticeInfo(NoticeInfo noticeinfo)
 {
     return DatabaseProvider.GetInstance().UpdateNoticeInfo(noticeinfo);
 }
Esempio n. 16
0
 /// <summary>
 /// 获取指定通知id的信息
 /// </summary>
 /// <param name="nid">通知id</param>
 /// <returns>通知信息</returns>
 public static NoticeInfo GetNoticeInfo(int nid)
 {
     NoticeInfo noticeinfo = new NoticeInfo();
     IDataReader idatareader = DatabaseProvider.GetInstance().GetNoticeByNid(nid);
     if (idatareader.Read())
     {
         LoadSingleNoticeInfo(idatareader);
     }
     idatareader.Close();
     return noticeinfo;
 }