Beispiel #1
0
 public override void OnPageLoad(object sender, EventArgs e)
 {
     base.OnPageLoad(sender, e);
     facade = new BrandRequestFacade();
 }
Beispiel #2
0
        public BrandRequestMaintain()
        {
            InitializeComponent();
            this.Loaded += (sender, e) =>
            {
                facade = new BrandRequestFacade();

                switch (Action)
                {
                case BrandAction.Edit:    //编辑

                    //根据SysNo得到数据并bing
                    facade.GetBrandBySysNo(BrandSysNo, (obj, arg) =>
                    {
                        //将所有控件IsEnabled设为true
                        foreach (var item in myGrid.Children)
                        {
                            if (item.GetType() == typeof(StackPanel))
                            {
                                StackPanel sp = (StackPanel)item;

                                foreach (var s in sp.Children)
                                {
                                    if (s.GetType() == typeof(TextBox))
                                    {
                                        ((TextBox)s).IsEnabled = true;
                                    }
                                    if (s.GetType() == typeof(Combox))
                                    {
                                        ((Combox)s).IsEnabled = true;
                                    }
                                    if (s.GetType() == typeof(CheckBox))
                                    {
                                        ((CheckBox)s).IsEnabled = true;
                                    }
                                    if (s.GetType() == typeof(Button))
                                    {
                                        ((Button)s).IsEnabled = true;
                                    }
                                }
                            }
                        }
                        this.linkPreview.IsEnabled = true;
                        this.BtnSave.Visibility    = Visibility.Visible;
                        //  this.myBrandAuthorized.Visibility = Visibility.Visible;
                        this.DataContext = new BrandRequestVM()
                        {
                            BrandName_Ch         = arg.Result.BrandNameLocal.Content,
                            BrandName_En         = arg.Result.BrandNameGlobal,
                            BrandStatus          = arg.Result.Status,
                            Info                 = arg.Result.BrandDescription.Content,
                            ManufacturerSysNo    = arg.Result.Manufacturer.SysNo.ToString(),
                            SupportEmail         = arg.Result.BrandSupportInfo.ServiceEmail,
                            SupportUrl           = arg.Result.BrandSupportInfo.ServiceUrl,
                            ManufacturerWebsite  = arg.Result.BrandSupportInfo.ManufacturerUrl,
                            AdImage              = arg.Result.Manufacturer.BrandImage,
                            IsDisPlayZone        = arg.Result.Manufacturer.IsShowZone == "Y",
                            IsLogo               = arg.Result.IsLogo == "Y",
                            BrandStoreType       = arg.Result.BrandStoreType,
                            CustomerServicePhone = arg.Result.BrandSupportInfo.ServicePhone,
                            BrandStory           = arg.Result.BrandStory,
                            ShowStoreUrl         = arg.Result.Manufacturer.ShowUrl,
                            ProductId            = arg.Result.ProductId,
                            BrandCode            = arg.Result.BrandCode
                        };
                    });
                    myBrandAuthorizedMaintain.BrandSysNo = BrandSysNo;
                    break;

                case BrandAction.Add:     //添加
                    this.BtnAudit.Visibility          = Visibility.Visible;
                    this.myAudit.Visibility           = Visibility.Visible;
                    this.txtNameCh.IsEnabled          = true;
                    this.txtProductLine.IsEnabled     = true;
                    this.txtReason.IsEnabled          = true;
                    this.ManufacturerPicker.IsEnabled = true;
                    this.txtNameEn.IsEnabled          = true;
                    txtBrandStory.IsEnabled           = false;
                    txtBrandCode.IsEnabled            = true;
                    facade.GetBrandCode((obj, arg) =>
                    {
                        this.DataContext = new BrandRequestVM()
                        {
                            BrandStatus = ValidStatus.DeActive, BrandCode = arg.Result
                        };                                                                                                         //默认无效
                    });
                    break;

                case BrandAction.Audit:     //审核
                    this.linkPreview.IsEnabled   = true;
                    txtBrandCode.IsEnabled       = false;
                    this.myAudit.Visibility      = Visibility.Visible;
                    this.BtnAuditByNo.Visibility = Visibility.Visible;
                    this.BtnAuditByOk.Visibility = Visibility.Visible;
                    this.DataContext             = Data;
                    break;

                default:
                    break;
                }
            };
        }