public AddOrUpdateATT(SKUATTModel model, short attTypeID, Guid skucid) { InitializeComponent(); this.ViewModel = new VMAddOrUpdateATT(model, attTypeID, skucid); this.ViewModel.HandleCompleted += ViewModel_HandleCompleted; this.Title = model == null ? "添加属性" : "修改属性"; this.txbCode.IsReadOnly = model != null; }
public VMAddOrUpdateATT(SKUATTModel model,short attTypeID, Guid skucid) { _isAdd = model == null; if (_isAdd) { _model = new SKUATTModel() { SKUCID = skucid, ATTType = attTypeID, }; } else { _model = new SKUATTModel(model.Entity); } this.CmdSave = new DelegateCommand(this.CmdSaveExecute); _bll = new BLLAttManagement(); }
private void GetSKUATTBySKUIDComplete(Task<List<SKUATT>> task) { if (task.Exception != null) { this.RefreshingVisibility = Visibility.Collapsed; Trace.TraceError(string.Format(@"{0},{1}", DateTime.Now.ToString(), task.Exception.Message)); MessageBox.Show("获取属性信息出错!"); return; } List<SKUATT> list = task.Result; if (list == null || list.Count == 0) { this.RefreshingVisibility = Visibility.Collapsed; return; } SKUATTModel model; foreach (SKUATT att in list) { model = new SKUATTModel(att); this.ItemsSource.Add(model); } this.RefreshingVisibility = Visibility.Collapsed; }