Esempio n. 1
0
        private void ButtonBannerEdit_Click(object sender, RoutedEventArgs e)
        {
            HyperlinkButton    btnEdit  = sender as HyperlinkButton;
            var                tempVM   = btnEdit.DataContext as FloorSectionBannerVM;
            UCBannerForSection ucBanner = new UCBannerForSection(tempVM.DeepCopy());

            ucBanner.Dialog = CurrentWindow.ShowDialog(ResFloorMaintain.Head_ProductSection, ucBanner, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    var result = args.Data as FloorSectionBannerVM;
                    FloorSectionItem sectionItem = result.ConvertVM <FloorSectionBannerVM, FloorSectionItem>((s, t) =>
                    {
                        t.ItemBanner = result.ConvertVM <FloorSectionBannerVM, FloorItemBanner>();
                    });

                    ServiceFacade.UpdateFloorSectionItem(sectionItem, (s, objArgs) =>
                    {
                        if (objArgs.FaultsHandle())
                        {
                            return;
                        }
                        for (int i = 0; i < BannerListVM.Count; i++)
                        {
                            if (BannerListVM[i].SysNo == tempVM.SysNo)
                            {
                                BannerListVM[i]          = result.DeepCopy();
                                BannerResult.ItemsSource = BannerListVM;
                                break;
                            }
                        }
                    });
                }
            });
        }
Esempio n. 2
0
        private void BtnAddBanner_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentVM == null)
            {
                CurrentWindow.Alert(ResFloorMaintain.Info_SectionChecked);
                return;
            }
            UCBannerForSection ucBanner = new UCBannerForSection();

            ucBanner.Dialog = CurrentWindow.ShowDialog(ResFloorMaintain.Head_BannerSection, ucBanner, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    var result = args.Data as FloorSectionBannerVM;
                    FloorSectionItem sectionItem = LoadSectionItem(result, FloorItemType.Banner);
                    sectionItem.ItemBanner       = result.ConvertVM <FloorSectionBannerVM, FloorItemBanner>();
                    ServiceFacade.CreateFloorSectionItem(sectionItem, (s, objArgs) =>
                    {
                        if (objArgs.FaultsHandle())
                        {
                            return;
                        }
                        result.SysNo = objArgs.Result;
                        BannerListVM.Add(result);
                        BannerResult.ItemsSource = BannerListVM;
                    });
                }
            });
        }