Exemplo n.º 1
0
 public AddOrUpdateTwo(SKUCGYModel model, Guid pid)
 {
     InitializeComponent();
     this.ViewModel = new VMAddOrUpdateTwo(model, pid);
     this.ViewModel.HandleCompleted += ViewModel_HandleCompleted;
     this.Title = model == null ? "添加二级" : "修改二级";
     this.txbCode.IsReadOnly = model != null;
 }
Exemplo n.º 2
0
 public AddOrUpdateOne(SKUCGYModel model)
 {
     InitializeComponent();
     this.ViewModel = new VMAddOrUpdateOne(model);
     this.ViewModel.HandleCompleted += ViewModel_HandleCompleted;
     this.Title = model == null ? "添加一级" : "修改一级";
     this.txbCode.IsReadOnly = model != null;
 }
Exemplo n.º 3
0
 public VMAddOrUpdateTwo(SKUCGYModel model, Guid pid)
 {
     _isAdd = model == null;
     if (_isAdd)
     {
         _model = new SKUCGYModel()
         {
             PID = pid,
             LevelIndex = 2,
         };
     }
     else
     {
         _model = new SKUCGYModel(model.Entity);
     }
     this.CmdSave = new DelegateCommand(this.CmdSaveExecute);
     _twoManagement = new BLLTwoManagement();
 }
Exemplo n.º 4
0
 private void GetOneListComplete(Task<List<SKUCGY>> 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<SKUCGY> list = task.Result;
     if(list == null || list.Count == 0)
     {
         this.RefreshingVisibility = Visibility.Collapsed;
         return;
     }
     SKUCGYModel model;
     foreach (SKUCGY cgy in list)
     {
         model = new SKUCGYModel(cgy);
         this.ItemsSource.Add(model);
     }
     this.RefreshingVisibility = Visibility.Collapsed;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 修改完毕事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AddOrUpdate_HandleCompleted(object sender, EntityEventArgs e)
 {
     SKUCGYModel model = e.Entity as SKUCGYModel;
     if (e.IsAdd)
     {
         this.ItemsSource.Add(model);
     }
     else
     {
         SKUCGYModel item = this.ItemsSource.Where(x => x.ID == model.ID).First();
         int index = this.ItemsSource.IndexOf(item);
         this.ItemsSource[index] = model;
     }
     this.SelectedItem = model;
     ApplicationContext.EventAggregator.GetEvent<OneChangedEvent>().Publish(model.Entity);
 }