Пример #1
0
        void UCPollAdd_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded -= new RoutedEventHandler(UCPollAdd_Loaded);
            facade  = new PollFacade(CPApplication.Current.CurrentPage);
            if (SysNo > 0)
            {
                facade.LoadPollMaster(SysNo, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    model                  = args.Result.Convert <PollMaster, PollListVM>();
                    model.ChannelID        = "1";
                    LayoutRoot.DataContext = model;

                    this.ucPageType.IsEnabled = model.PageType.HasValue && model.PageType != 4;

                    this.ucPageType.PageTypeLoadCompleted += new EventHandler(ucPageType_PageTypeLoadCompleted);
                    this.ucPageType.PageLoadCompleted     += new EventHandler(ucPageType_PageLoadCompleted);
                });
            }
            else
            {
                model                  = new PollListVM();
                model.SysNo            = "0";
                model.ChannelID        = "1";
                model.Status           = ADStatus.Deactive;
                LayoutRoot.DataContext = model;
            }
        }
Пример #2
0
        /// <summary>
        /// 编辑-》到投票组页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hlEdit_Click(object sender, RoutedEventArgs e)
        {
            PollListVM item = this.QueryResultGrid.SelectedItem as PollListVM;

            Window.Navigate(string.Format(ConstValue.MKT_PollItemGroupMaintainUrlFormat, item.SysNo), null, true);


            //dynamic item = this.QueryResultGrid.SelectedItem as dynamic;
            //UCPollAdd usercontrol = new UCPollAdd();
            //usercontrol.SysNo = item.SysNo;
            //IDialog dialog = Window.ShowDialog("编辑投票", usercontrol, (obj, args) =>
            //{
            //    QueryResultGrid.Bind();
            //});
        }
Пример #3
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            model   = new PollListVM();
            facade  = new PollFacade(this);
            groupVM = new PollItemGroupVM();

            comStatus.ItemsSource = EnumConverter.GetKeyValuePairs <ADStatus>(EnumConverter.EnumAppendItemType.All);
            List <KeyValuePair <PollType?, string> > types = EnumConverter.GetKeyValuePairs <PollType>();

            types.RemoveAt(3);
            comPollType.ItemsSource = types;

            SysNo = int.Parse(this.Request.Param);
            facade.LoadPollMaster(SysNo, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                model                    = args.Result.Convert <PollMaster, PollListVM>();
                model.ChannelID          = "1";
                PollBaseInfo.DataContext = model;

                this.ucPageType.PageTypeLoadCompleted += new EventHandler(ucPageType_PageTypeLoadCompleted);
                this.ucPageType.PageLoadCompleted     += new EventHandler(ucPageType_PageLoadCompleted);

                List <PollItemGroupVM> list = new List <PollItemGroupVM>();
                foreach (PollItemGroup item in model.PollItemGroupList)
                {
                    list.Add(item.Convert <PollItemGroup, PollItemGroupVM>());
                }
                PollGroupInfoGrid.ItemsSource = list;
            });

            PollGroupInfo.DataContext = groupVM;
        }