Ejemplo n.º 1
0
        /// <summary>
        /// Sends a message to all players to notify them of the keep capture
        /// </summary>
        /// <param name="keep">The keep object</param>
        public static void BroadcastCapture(AbstractGameKeep keep)
        {
            string message = "";

            if (keep.Realm != eRealm.None)
            {
                message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastCapture.Captured", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name));
            }
            else
            {
                message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastCapture.CapturedR0", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name));
            }

            /*
             * switch (GameServer.Instance.Configuration.ServerType)
             * {
             *      case eGameServerType.GST_Normal:
             *              {
             *                      message = string.Format("The forces of {0} have captured {1}!", GlobalConstants.RealmToName((eRealm)keep.Realm), keep.Name);
             *                      break;
             *              }
             *      case eGameServerType.GST_PvP:
             *              {
             *                      string defeatersStr = "";
             *                      message = string.Format("The forces of {0} have defeated the defenders of {1}!", defeatersStr, keep.Name);
             *                      break;
             *              }
             * }*/

            BroadcastMessage(message, eRealm.None);
            NewsMgr.CreateNews(message, keep.Realm, eNewsType.RvRGlobal, false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取新闻详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(int id)
        {
            ViewBag.CurrentUser = CurrentUser;
            if (CurrentUser != null)
            {
                ViewBag.Collection = AccountMgr.GetUserCollection(CurrentUser.id, ContentType.新闻, id);
            }

            var obj = NewsMgr.GetNews(id);

            #region 将新闻图片列表自定义序列化为json字符串
            if (obj.news_image.Count > 0)
            {
                var json = string.Empty;
                foreach (var img in obj.news_image)
                {
                    json += string.Format(@"{{ url: '/FileUpload/news/{0}/{1}', caption: '{2}' }}, ",
                                          id.ToString(), img.cmn_image.path, img.description);
                }
                ViewBag.ImagesJson = "[" + json + "]";
            }
            #endregion

            return(View(obj));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a message to all players to notify them of the raize
        /// </summary>
        /// <param name="keep">The keep object</param>
        /// <param name="realm">The raizing realm</param>
        public static void BroadcastRaize(AbstractGameKeep keep, eRealm realm)
        {
            string message = string.Format(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "PlayerManager.BroadcastRaize.Razed", keep.Name, GlobalConstants.RealmToName(realm)));

            BroadcastMessage(message, eRealm.None);
            NewsMgr.CreateNews(message, keep.Realm, eNewsType.RvRGlobal, false);
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int pageSize  = Convert.ToInt32(context.Request["pSize"]);
            int pageIndex = Convert.ToInt32(context.Request["pIndex"]);
            int id        = Convert.ToInt32(context.Request["nSortId"]);
            var list      = new NewsMgr().GetNewsList(pageSize, pageIndex, id);

            var totalCount = new NewsMgr().SelectRowCount(id);
            var pageCount  = 1;

            if (totalCount % pageSize > 0)
            {
                pageCount = totalCount / pageSize + 1;
            }
            else
            {
                pageCount = totalCount / pageSize;
            }

            NewsListPageCount pc = new NewsListPageCount();

            pc.List      = list;
            pc.PageCount = pageCount;

            string str = new JavaScriptSerializer().Serialize(pc);

            context.Response.Write(str);
        }
Ejemplo n.º 5
0
        public ActionResult SubmitSearch()
        {
            var title = Request.Form["title"];
            //var type = Request.Form["type"];
            var fromDT      = DateTime.Parse(Request.Form["fromDT"]);
            var toDT        = DateTime.Parse(Request.Form["toDT"]);
            var author      = Request.Form["author"];
            var author_dept = Request.Form["author_dept"];

            ArticleType?artile_type = null;

            //if (type == "1")
            //    artile_type = ArticleType.学术类;
            //else if (type == "2")
            //    artile_type = ArticleType.科普类;

            //ViewBag.Article_List = ArticleMgr.QueryArticles(title, artile_type, fromDT, toDT, author, author_dept);

            ViewBag.News_List = NewsMgr.QueryNews(title, fromDT, toDT, author, author_dept);

            if (string.IsNullOrEmpty(author) == true &&
                string.IsNullOrEmpty(author_dept) == true)
            {
                ViewBag.Cds_List = CdsMgr.QueryCds(title);
            }

            return(View("SearchResult"));
        }
Ejemplo n.º 6
0
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            var title = txtTitle.Text.Trim();
            var sort  = ddlSort.Text.Trim();

            if (sort == "全部" && title != null)
            {
                News_Datail model = new News_Datail
                {
                    NewsTitle = title
                };
                DataSet ds = new NewsMgr().Select4(model);
                GridView1.DataSource = ds.Tables[0];
                GridView1.DataBind();
            }
            else if (sort != "全部" && title != null)
            {
                var         id    = Convert.ToInt32(sort);
                News_Datail model = new News_Datail
                {
                    NewsTitle  = title,
                    NewsSortId = id
                };
                DataSet ds = new NewsMgr().Select3(model);
                GridView1.DataSource = ds.Tables[0];
                GridView1.DataBind();
            }
        }
Ejemplo n.º 7
0
        public void newsBind()
        {
            var list = new NewsMgr().SelectSortList();

            GridView1.DataSource = list;
            GridView1.DataBind();
        }
Ejemplo n.º 8
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (client.Player == null)
            {
                return;
            }

            if (IsSpammingCommand(client.Player, "news"))
            {
                return;
            }

            NewsMgr.DisplayNews(client);
        }
Ejemplo n.º 9
0
 public void editBind()
 {
     if (Request["id"] != null)
     {
         int    id    = Convert.ToInt32(Request["id"]);
         Public model = new Public
         {
             ID = id
         };
         var list = new NewsMgr().Select5(model);
         foreach (var item in list)
         {
             var listItem = new ListItem(item.NewsSortName, item.NewsSortId.ToString());
             ddlSort.Items.Add(listItem);
             tbTitle.Text          = item.NewsTitle;
             CKEditorControl1.Text = item.NewsContent;
         }
     }
 }
Ejemplo n.º 10
0
        public ActionResult SubmitNewsComments(int id, string content)
        {
            if (string.IsNullOrEmpty(content) == true)
            {
                return(Content("评论内容不可为空。"));
            }

            var obj = new news_comments()
            {
                news_id    = id,
                comments   = content,
                user_id    = CurrentUser.id,
                user_name  = CurrentUser.name,
                created_dt = DateTime.Now
            };

            NewsMgr.InsertNewsComments(obj);

            return(Content("OK"));
        }
Ejemplo n.º 11
0
 public void contentBind()
 {
     if (Request["id"] == null)
     {
         DataSet ds = new NewsMgr().Select6();
         lbContent.Text     = ds.Tables[0].Rows[0]["NewsContent"].ToString();
         lbCreatedTime.Text = Convert.ToString(ds.Tables[0].Rows[0]["CreatedTime"]);
         lbTitle.Text       = ds.Tables[0].Rows[0]["NewsTitle"].ToString();
     }
     else
     {
         var         id    = Convert.ToInt32(Request["id"]);
         News_Datail model = new News_Datail
         {
             ID = id
         };
         DataSet ds = new NewsMgr().SelectNewsContentById(model);
         lbContent.Text     = ds.Tables[0].Rows[0]["NewsContent"].ToString();
         lbTitle.Text       = ds.Tables[0].Rows[0]["NewsTitle"].ToString();
         lbCreatedTime.Text = ds.Tables[0].Rows[0]["CreatedTime"].ToString();
     }
 }
Ejemplo n.º 12
0
 public ActionResult DeleteNewsComments(int id, int comments_id)
 {
     NewsMgr.DeleteNewsComments(comments_id);
     return(Content("OK"));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取新闻列表
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var all = NewsMgr.GetNewsList();

            return(View(all));
        }