public UCFloorMaintain(FloorVM vm)
        {
            InitializeComponent();
            if (vm.SysNo > 0)
            {
                Model = new FloorVM()
                {
                    SysNo         = vm.SysNo,
                    FloorLogoSrc  = vm.FloorLogoSrc,
                    FloorName     = vm.FloorName,
                    Remark        = vm.Remark,
                    Status        = vm.Status,
                    TemplateName  = vm.TemplateName,
                    Templates     = vm.Templates,
                    TemplateSysNo = vm.TemplateSysNo,
                    Priority      = vm.Priority,
                    PageType      = vm.PageType,
                    PageCode      = vm.PageCode,
                    PageName      = vm.PageName,
                };
            }
            else
            {
                Model = vm;
            }
            facade = new FloorFacade(CPApplication.Current.CurrentPage);
            cbPageCodes.ItemsSource   = EnumConverter.GetKeyValuePairs <PageCodeType>(EnumConverter.EnumAppendItemType.Select);
            cbPageCodes.SelectedIndex = 0;

            this.cbPageCodes.SelectionChanged += new SelectionChangedEventHandler(cbPageCodes_SelectionChanged);
            this.DataContext = Model;
        }
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            ServiceFacade = new FloorFacade(this);
            var floorSysNo = Request.Param;

            ServiceFacade.GetFloorMaster(floorSysNo, (objMaster, argsMaster) =>
            {
                if (argsMaster.FaultsHandle())
                {
                    return;
                }
                FloorVM      = argsMaster.Result.Convert <FloorMaster, FloorVM>();
                tlCon.Header = string.Format("{0}—{1}", FloorVM.FloorName, ResFloorMaintain.Expander_MaintainTitle);

                ServiceFacade.GetFloorSectionList(floorSysNo, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    var sectionList    = EntityConverter <List <FloorSection>, List <FloorSectionVM> > .Convert(args.Result);
                    FloorSectionListVM = sectionList;
                    ucFloorSection.FloorSectionMaintain = this;
                    if (sectionList.Count > 0)
                    {
                        var defaultSection       = sectionList.First();
                        defaultSection.IsChecked = true;
                        TagChecedBindData(defaultSection);
                    }
                });
            });
        }
 public UCFloorMaintain()
 {
     InitializeComponent();
     Model       = new FloorVM();
     DataContext = Model;
     facade      = new FloorFacade(CPApplication.Current.CurrentPage);
 }
Beispiel #4
0
 public override void OnPageLoad(object sender, EventArgs e)
 {
     base.OnPageLoad(sender, e);
     facade = new FloorFacade(this);
     facade.GetTemplate((s, args) =>
     {
         Templates = args.Result;
         cbPageCodes.ItemsSource   = EnumConverter.GetKeyValuePairs <PageCodeType>(EnumConverter.EnumAppendItemType.All);
         cbPageCodes.SelectedIndex = 0;
         DataGrid.Bind();
     });
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ValidationManager.Validate(this);
            if (Model.HasValidationErrors)
            {
                return;
            }

            Model.PageName = Model.PageType == PageCodeType.C1 || Model.PageType == PageCodeType.Promotion ? ((KeyValuePair <string, string>)cbPageID.SelectedItem).Value : ((PageCodeType)cbPageCodes.SelectedValue).ToDescription();
            facade         = new FloorFacade(((IPage)CPApplication.Current.CurrentPage));
            facade.Save(Model, (s, args) =>
            {
                Dialog.Close(true);
            });
        }
Beispiel #6
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidationManager.Validate(this.LayoutRoot))
            {
                return;
            }
            var floorFacade = new FloorFacade(CPApplication.Current.CurrentPage);

            CurrentVM.FloorMasterSysNo = FloorSectionMaintain.FloorVM.SysNo;

            if (CurrentVM.SysNo.HasValue)
            {
                floorFacade.UpdateFloorSection(CurrentVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentWindow.Alert(ResFloorMaintain.Info_EditSuccess);
                    for (int i = 0; i < FloorSectionMaintain.FloorSectionListVM.Count; i++)
                    {
                        if (FloorSectionMaintain.FloorSectionListVM[i].SysNo == CurrentVM.SysNo)
                        {
                            CurrentVM.IsChecked = true;
                            FloorSectionMaintain.FloorSectionListVM[i]        = CurrentVM.DeepCopy();
                            FloorSectionMaintain.SectionTagResult.ItemsSource = FloorSectionMaintain.FloorSectionListVM;
                            break;
                        }
                    }
                });
            }
            else
            {
                floorFacade.CreateFloorSection(CurrentVM, (s, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CurrentVM.SysNo = args.Result;
                    FloorSectionMaintain.FloorSectionListVM.Add(CurrentVM);
                    CurrentWindow.Alert(ResFloorMaintain.Info_CreateSuccess);
                    FloorSectionMaintain.SectionTagResult.ItemsSource = FloorSectionMaintain.FloorSectionListVM;
                });
            }
        }
Beispiel #7
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            facade = new FloorFacade(this);
            facade.GetTemplate((s, args) =>
            {
                Templates = args.Result;
            });

            facade.QueryPageID(((int)PageCodeType.Promotion).ToString(), CPApplication.Current.CompanyCode, (s, args) =>
            {
                args.Result.Insert(0, new KeyValuePair <string, string>(string.Empty, ResCommonEnum.Enum_All));
                cbPageID.ItemsSource   = args.Result;
                cbPageID.SelectedValue = string.IsNullOrEmpty(this.Request.Param) || args.Result.FirstOrDefault(t => t.Key == this.Request.Param).Key == null? string.Empty : this.Request.Param;
                DataGrid.Bind();
            });
        }
        private void InitBrands()
        {
            List <KeyValuePair <int, string> > brandList = new List <KeyValuePair <int, string> >();
            var facade = new FloorFacade(CPApplication.Current.CurrentPage);

            facade.QueryBrand((s, args) =>
            {
                var data = args.Result as dynamic;
                foreach (var row in data.Rows)
                {
                    if (!string.IsNullOrWhiteSpace(row.BrandName_Ch))
                    {
                        brandList.Add(new KeyValuePair <int, string>(row.SysNo, row.BrandName_Ch));
                    }
                }
                cmbBrands.ItemsSource = brandList;
                DataContext           = vm;
            });
        }
Beispiel #9
0
 private void UCFloorSectionData_Loaded(object sender, RoutedEventArgs e)
 {
     ServiceFacade = new FloorFacade(CPApplication.Current.CurrentPage);
     this.Loaded  -= UCFloorSectionData_Loaded;
 }