コード例 #1
0
        /// <summary>
        /// 撤销泰隆优选大使公告。
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public void UndoAmbassadorNews(AmbassadorNewsVM data, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            NewsInfoMaintainVM news = new NewsInfoMaintainVM();

            if (data != null)
            {
                news.SysNo    = data.SysNo;
                news.NewsType = 12;
                news.Status   = NewsStatus.Deactive;
                news.Title    = data.Title;
                news.Content  = data.Content;
                ///处理大区信息。
                if (data.ReferenceSysNo < 0)
                {
                    news.ReferenceSysNo = 0;
                }
                else
                {
                    news.ReferenceSysNo = data.ReferenceSysNo;
                }

                NewsInfo entity = news.ConvertVM <NewsInfoMaintainVM, NewsInfo>();
                entity.Title.Content   = news.Title;
                entity.Content.Content = news.Content;
                if (CurrentNewsFacade != null)
                {
                    CurrentNewsFacade.Update(entity, callback);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this.LayoutRoot))
            {
                return;
            }
            if (ucPosition.PageType == null)
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("类型不能为空!", MessageType.Warning);
                return;
            }

            if (string.IsNullOrWhiteSpace(viewModel.LinkUrl) && string.IsNullOrWhiteSpace(viewModel.Content))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("正文链接和正文内容不可都为空!", MessageType.Warning);
                return;
            }
            entity = viewModel.ConvertVM <NewsInfoMaintainVM, NewsInfo>();
            entity.Title.Content   = viewModel.Title;
            entity.Content.Content = viewModel.Content;
            entity.NewsType        = ucPosition.PageType;
            entity.ReferenceSysNo  = ucPosition.PageID ?? -1;
            entity.Extendflag      = ucPosition.IsExtendValid;
            entity.WebChannel      = new BizEntity.Common.WebChannel()
            {
                ChannelID = viewModel.ChannelID
            };
            entity.CoverImageUrl = viewModel.CoverImageUrl;
            entity.Subtitle      = viewModel.Subtitle;
            entity.SysNo         = 0;
            facade.Create(entity, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                CPApplication.Current.CurrentPage.Context.Window.Alert("操作成功!");
                dialog.ResultArgs.DialogResult = DialogResultType.OK;
                dialog.Close();
            });
        }