Beispiel #1
0
        /// <summary>
        /// 公告
        /// </summary>
        /// <param name="note"></param>
        public static void Notice(GMNote note)
        {
            Variant v = note.GetVariant(1);
            if (v == null)
            {
                return;
            }

            Notice model = new Entity.Notice();
            model.ID = ObjectId.GenerateNewId().ToString();
            model.Name = v.GetStringOrDefault("Name");
            model.StartTime = v.GetUtcTimeOrDefault("StartTime");
            model.EndTime = v.GetUtcTimeOrDefault("EndTime");
            model.Sort = v.GetIntOrDefault("Sort");
            model.Content = v.GetStringOrDefault("Content");
            model.Count = v.GetIntOrDefault("Count");
            model.Rate = v.GetIntOrDefault("Rate");
            model.Status = v.GetIntOrDefault("Status");
            model.Place = v.GetStringOrDefault("Place");
            if (model.Save())
            {
                NoticeAccess.Instance.AddNotice(model);
                note.Call(GMCommand.GMR, TipManager.GetMessage(GMReturn.Notice1));
            }
            else
            {
                note.Call(GMCommand.GMR, "");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 公告
        /// </summary>
        /// <param name="note"></param>
        public static object Notice(Notification note)
        {
            Variant v = note.GetVariant(0);
            if (v == null)
            {
                return null;
            }

            Notice model = new Entity.Notice();
            model.ID = ObjectId.GenerateNewId().ToString();
            model.Name = v.GetStringOrDefault("Name");
            model.StartTime = v.GetUtcTimeOrDefault("StartTime");
            model.EndTime = v.GetUtcTimeOrDefault("EndTime");
            model.Sort = v.GetIntOrDefault("Sort");
            model.Content = v.GetStringOrDefault("Content");
            model.Count = v.GetIntOrDefault("Count");
            model.Rate = v.GetIntOrDefault("Rate");
            model.Status = v.GetIntOrDefault("Status");
            model.Place = v.GetStringOrDefault("Place");
            if (model.Save())
            {
                NoticeAccess.Instance.AddNotice(model);
                return TipManager.GetMessage(GMReturn.Notice1);
            }
            return string.Empty;
        }