Example #1
0
        /// <summary>
        /// 更新单个选项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hlUpdate_Click(object sender, RoutedEventArgs e)
        {
            PollItemGroupVM vm = this.PollGroupInfoGrid.SelectedItem as PollItemGroupVM;

            ValidationManager.Validate(this.PollGroupInfoGrid);
            if (vm.HasValidationErrors)
            {
                return;
            }

            PollItemGroup item = EntityConvertorExtensions.ConvertVM <PollItemGroupVM, PollItemGroup>(vm, (v, t) =>
            {
                t.GroupName = new BizEntity.LanguageContent(ConstValue.BizLanguageCode, v.GroupName);
            });

            facade.UpdatePollItemGroup(item, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                Window.Alert(ResNewsInfo.Information_UpdateSuccessful, MessageType.Information);
                PollGroupInfoGrid.Bind();
            });
        }
Example #2
0
        /// <summary>
        /// 创建单个选项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hlCreateItem_Click(object sender, RoutedEventArgs e)
        {
            PollItemGroupVM vm = this.PollGroupInfoGrid.SelectedItem as PollItemGroupVM;

            UCEditPollOption usercontrol = new UCEditPollOption();

            usercontrol.SysNo    = vm.SysNo.Value;
            usercontrol.pollType = vm.Type;
            usercontrol.Dialog   = Window.ShowDialog(ResNewsInfo.Title_CreatePollItemOption, usercontrol, (obj, args) =>
            {
            });
        }
Example #3
0
        /// <summary>
        /// 删除单个选项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void hlDelete_Click(object sender, RoutedEventArgs e)
        {
            PollItemGroupVM vm = this.PollGroupInfoGrid.SelectedItem as PollItemGroupVM;

            if (vm != null)
            {
                facade.DeletePollItemGroup(vm.SysNo.Value, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    PollGroupInfoGrid.Bind();
                });
            }
        }
Example #4
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;
        }