Example #1
0
        public ActionResult AjaxAnnouncementEdit(AnnouncementParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try {
                if (param.Forever)
                {
                    param.Announcement.EndDate = new System.DateTime(9999, 12, 31, 23, 59, 59);
                }
                param.Announcement.StartDate = TimeZoneInfo.ConvertTimeToUtc(param.Announcement.StartDate,
                                                                             Section.Get.Common.TimeZone);
                param.Announcement.EndDate = TimeZoneInfo.ConvertTimeToUtc(param.Announcement.EndDate,
                                                                           Section.Get.Common.TimeZone);

                r.Code = (0L < param.Announcement.AnnouncementId
                    ? AnnouncementTableProvider.Update(param)
                    : AnnouncementTableProvider.Create(param)).ToString(Section.Get.Common.Culture);
                //通知Master更新快取
                //  MasterServer.GetInstance().RefreshGameAnnouncements();
            }
            catch (Exception ex) {
                Log.Error(ex.Message, ex);
                r.Code = "-11" + ex.Message;
            }
            result.Data = r;
            return(result);
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public ActionResult Announcements(AnnouncementParameter param)
 {
     param.KeyWord = HttpUtility.UrlDecode(param.KeyWord);
     return(View(
                new InternalDataTransferToView {
         List = AnnouncementTableProvider.List(param),
         Data = param
     }));
 }
Example #3
0
 public ActionResult AnnouncementEdit(AnnouncementParameter param)
 {
     if (0L < param.Announcement.AnnouncementId)
     {
         param.Announcement.Fill(AnnouncementTableProvider.Detail(param));
     }
     return(View(new InternalDataTransferToView {
         Data = param
     }));
 }
Example #4
0
        public ActionResult AjaxAnnouncementDelete(AnnouncementParameter param)
        {
            var result = new JsonNetResult();
            var r      = new GeneralResponse();

            try {
                var detail = AnnouncementTableProvider.Detail(param);
                r.Code = AnnouncementTableProvider.Delete(param).ToString(Section.Get.Common.Culture);

                if (!string.IsNullOrEmpty(detail["ImgPath"]))
                {
                    Io.DeleteFile(System.Web.HttpContext.Current.Server.MapPath($"~{detail["ImgPath"]}"));
                }
            }
            catch (Exception ex) {
                Log.Error(ex.Message, ex);
                r.Code = "-11";
            }
            result.Data = r;
            return(result);
        }