private void btnSelectFiles_Click(object sender, RoutedEventArgs e) { _facade = new ProductResourcesManagementFacade(_productResourcesVM); _facade.SelectFiles(); var fileNames = _productResourcesVM.ResourceCollection.Select(p => p.File.Name).ToList(); _facade.IsExistFileName(fileNames, (obj, arg) => { if (arg.FaultsHandle()) { return; } var files = arg.Result; foreach (var item in _productResourcesVM.ResourceCollection) { if (item.FileUploadProcessStates == FileUploadProcessStates.Checking) { item.FileUploadProcessStates = FileUploadProcessStates.WaitingToUpload; if (files != null && files.Contains(item.File.Name)) { item.Remark = "存在相同的图片或视频"; if (!item.FileUploadProcessStatesDesc.Contains("*")) { item.FileUploadProcessStatesDesc = item.FileUploadProcessStatesDesc + "(*)"; } } } } }); }
private void btnClearList_Click(object sender, RoutedEventArgs e) { _facade = new ProductResourcesManagementFacade(_productResourcesVM); if (_sysNo > 0) { _facade.OnBind += Bind; } else { _facade.OnBind += OtherBind; } _facade.ClearWaitUploadFiles(); }
private void MoveBottomButton_Click(object sender, RoutedEventArgs e) { _facade = new ProductResourcesManagementFacade(_productResourcesVM); var item = ListBox_ImageList.SelectedItem as dynamic; _facade.OnSort = Sort; if (item == null || item.Resource == null || item.Resource.ResourceSysNo <= 0) { Window.MessageBox.Show("请选择一条记录.", MessageBoxType.Warning); return; } _facade.MoveBottom(item.Resource.ResourceSysNo); }
private void dgProductResource_LoadingDataSource(object sender, LoadingDataEventArgs e) { _facade = new ProductResourcesManagementFacade(); if (_productResourcesVM == null) { return; } var count = _productResourcesVM.ResourceCollection.Where( p => p.FileUploadProcessStates == FileUploadProcessStates.Finished).Count(); if (count > 0) { var queryVM = new ProductResourcesQueryVM { CommonSKUNumberList = _productResourcesVM.ResourceCollection .Where(p => p.FileUploadProcessStates == FileUploadProcessStates.Finished) .Select(p => p.CommonSKUNumber).ToList() }; _facade.QueryResources(queryVM, e.SortField, (obj, args) => { if (args.FaultsHandle()) { return; } dgProductResource.ItemsSource = args.Result.Rows; _productResourcesVM.ProductGroupCount = args.Result.TotalCount; var skuCount = _productResourcesVM.ResourceCollection .Select(p => p.CommonSKUNumber) .Distinct().Count(); _productResourcesVM.CommonSKUCount = skuCount; _productResourcesVM.SucessCount = count; var tempCount = _productResourcesVM.ResourceCollection.Count - count; _productResourcesVM.FaileCount = tempCount; }); } else { dgProductResource.ItemsSource = null; _productResourcesVM.ProductGroupCount = 0; _productResourcesVM.CommonSKUCount = 0; _productResourcesVM.SucessCount = 0; _productResourcesVM.FaileCount = 0; } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { _facade = new ProductResourcesManagementFacade(_productResourcesVM); var item = ListBox_ImageList.SelectedItem as dynamic; _facade.OnSort = Sort; if (item == null || item.Resource == null || item.Resource.ResourceSysNo <= 0) { Window.MessageBox.Show("请选择一条记录.", MessageBoxType.Warning); return; } if (_productResourcesVM == null || _productResourcesVM.ProductResources.Count == 1) { Window.MessageBox.Show("不能删除最后一张图片.", MessageBoxType.Warning); return; } _facade.Delete(item.Resource.ResourceSysNo); SaveButton_Click(null, null); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { _facade = new ProductResourcesManagementFacade(_productResourcesVM); _facade.Save(); }