Ejemplo n.º 1
0
        public void Create(ComputerConfigMasterVM vm, EventHandler <RestClientEventArgs <object> > callback)
        {
            var    data        = ConvertVMToEntity(vm);
            string relativeUrl = "/MKTService/ComputerConfig/Create";

            restClient.Create(relativeUrl, data, callback);
        }
Ejemplo n.º 2
0
 private void SetAllReadOnly(ComputerConfigMasterVM _vm)
 {
     foreach (UIElement item in this.gridMain.Children)
     {
         if (item is TextBox)
         {
             ((TextBox)item).IsReadOnly = true;
         }
         if (item is Combox)
         {
             ((Combox)item).IsEnabled = false;
         }
     }
     _vm.ConfigItemList.ForEach(item => item.IsControlReadOnly = true);
 }
Ejemplo n.º 3
0
 private void ButtonNew_Click(object sender, RoutedEventArgs e)
 {
     _isEditing                    = false;
     this.Title                    = ResComputerConfig.Info_AddTitle;
     this.btnSave.IsEnabled        = true;
     this.lstChannel.SelectedIndex = 0;
     new ComputerConfigFacade(this).GetAllParts((itemVMList) =>
     {
         _currentVM                = new ComputerConfigMasterVM();
         _currentVM.Status         = ComputerConfigStatus.Origin;
         _currentVM.ConfigItemList = itemVMList;
         this.DataContext          = _currentVM;
         this.btnSave.Visibility   = Visibility.Visible;
         this.btnSubmit.Visibility = System.Windows.Visibility.Visible;
     });
 }
Ejemplo n.º 4
0
        private ComputerConfigMaster ConvertVMToEntity(ComputerConfigMasterVM vm)
        {
            var data = vm.ConvertVM <ComputerConfigMasterVM, ComputerConfigMaster>();

            data.CompanyCode = CPApplication.Current.CompanyCode;
            data.WebChannel  = new WebChannel
            {
                ChannelID = vm.ChannelID
            };
            data.ConfigItemList = new List <ComputerConfigItem>();
            foreach (var item in vm.ConfigItemList)
            {
                if (item.ProductSysNo > 0 && item.ProductQty > 0)
                {
                    var result = item.ConvertVM <ComputerConfigItemVM, ComputerConfigItem>();
                    data.ConfigItemList.Add(result);
                }
            }
            return(data);
        }
Ejemplo n.º 5
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            //页面加载后固定跨列的文本框的宽度
            this.txtConfigName.Width  = this.txtConfigName.ActualWidth;
            this.txtDescription.Width = this.txtDescription.ActualWidth;

            this.lstChannel.ItemsSource = CPApplication.Current.CurrentWebChannelList.ToList <UIWebChannel>();
            if (string.IsNullOrEmpty(this.Request.Param))
            {
                _isEditing = false;
                this.Title = ResComputerConfig.Info_AddTitle;
                new ComputerConfigFacade(this).GetAllParts((itemVMList) =>
                {
                    _currentVM                        = new ComputerConfigMasterVM();
                    _currentVM.Status                 = ComputerConfigStatus.Origin;
                    _currentVM.ConfigItemList         = itemVMList;
                    this.DataContext                  = _currentVM;
                    this.lstChannel.SelectedIndex     = 0;
                    this.lstConfigTypes.SelectedIndex = 0;
                    this.btnSave.Visibility           = Visibility.Visible;
                    this.btnSubmit.Visibility         = System.Windows.Visibility.Visible;
                });
            }
            else
            {
                if (this.Request.UserState != null &&
                    (ComputerConfigMaintainMode)this.Request.UserState == ComputerConfigMaintainMode.Copy)
                {
                    //复制新建
                    _isEditing = false;
                    this.Title = ResComputerConfig.Info_AddTitle;
                }
                else
                {
                    _isEditing = true;
                    this.Title = ResComputerConfig.Info_EditTitle;
                }
                new ComputerConfigFacade(this).Load(int.Parse(this.Request.Param), (masterVM) =>
                {
                    _currentVM = masterVM;
                    if (!_isEditing)
                    {
                        //复制新建时修改拷贝过来的VM状态
                        _currentVM.Status = ComputerConfigStatus.Origin;
                        _currentVM.SysNo  = null;
                    }
                    if (_currentVM.Status == ComputerConfigStatus.Pending)
                    {
                        //this.btnSave.Visibility = System.Windows.Visibility.Visible;
                        this.btnApprovePass.Visibility    = System.Windows.Visibility.Visible;
                        this.btnApproveDecline.Visibility = System.Windows.Visibility.Visible;
                    }
                    else if (_currentVM.Status == ComputerConfigStatus.Origin)
                    {
                        this.btnSave.Visibility   = Visibility.Visible;
                        this.btnSubmit.Visibility = System.Windows.Visibility.Visible;
                    }
                    if (_currentVM.Status == ComputerConfigStatus.Pending ||
                        _currentVM.Status == ComputerConfigStatus.Running ||
                        _currentVM.Status == ComputerConfigStatus.Void)
                    {
                        //禁止输入
                        SetAllReadOnly(_currentVM);
                    }
                    this.DataContext = _currentVM;
                });
            }
        }