public override void Search() { MainRowList.Clear(); GetMaindata(); if (SearchWindow == null) { SearchWindow = new GenericSearchWindow(GetSearchModel()); } GenericSearchViewModel <TransferHeader> vm = new GenericSearchViewModel <TransferHeader>() { Title = "Transfer Search" }; vm.FilteredItemsList = MainRowList; vm.ItemsList = MainRowList; vm.ResultItemsList.CollectionChanged += (s, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { SelectedMainRow = vm.ResultItemsList[e.NewStartingIndex]; } RaisePropertyChanged(nameof(IsReadOnly)); }; vm.GetDataCommand = new SilverlightCommands.RelayCommand((o) => { Filter = vm.Filter; ValuesObjects = vm.ValuesObjects; GetMaindata(); }, (o) => { return(true);//هنا الصلاحيات }); SearchWindow.DataContext = vm; base.Search(); }
public override void Cancel() { MainRowList.Clear(); SelectedMainRows.Clear(); AddNewMainRow(false); base.Cancel(); }
internal void SearchHeader() { MainRowList.Clear(); GetAllAcc(); var childWindowSeach = new AccessorySearcResultChildWindow(this); childWindowSeach.Show(); }
private void Getdata() { if (Season != 0 && Brand != null && BrandSection != 0) { MainRowList.Clear(); GetMaindata(); } }
public override void Cancel() { MainRowList.Clear(); SelectedMainRows.Clear(); AddNewMainRow(false); RaisePropertyChanged(nameof(IsReadOnly)); base.Cancel(); }
public void GetMaindata() { if (SortBy == null) { SortBy = "it.Iserial"; } MainRowList.Clear(); Client.GetTblBrandSectionMailAsync(Brand, BrandSection); }
public void GetMaindata() { if (SortBy == null) { SortBy = "it.Iserial"; } Loading = true; MainRowList.Clear(); Glclient.GetTblInventPostingAsync(TblInventAccountType, LoggedUserInfo.DatabasEname, JournalAccountTypePerRow.Iserial); }
private void MainRowList_OnRefresh(object sender, RefreshEventArgs e) { if (!Loading) { MainRowList.Clear(); SortBy = null; foreach (var sortDesc in MainRowList.SortDescriptions) { SortBy = SortBy + "it." + sortDesc.PropertyName + (sortDesc.Direction == ListSortDirection.Ascending ? " ASC" : " DESC"); } GetMaindata(); } }
public DyeingOrderInvoiceViewModel() : base(PermissionItemName.DyeingOrderInvoice) { GetItemPermissions(PermissionItemName.DyeingOrderInvoice.ToString()); //PermissionItemName.dyeing DyeingServiceClient.PostDyeingOrderInvoiceCompleted += (s, sv) => { if (sv.Result != null) { SelectedMainRow.InjectFrom(sv.Result); } SelectedMainRow.VisPosted = false; MessageBox.Show("Posted Completed"); }; DyeingServiceClient.DeleteDyeingOrderInvoiceHeaderCompleted += (s, ev) => { if (ev.Error != null) { MessageBox.Show(ev.Error.Message); } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; MiscValueTypeList = new ObservableCollection <GenericTable> { new GenericTable { Iserial = 0, Code = "%", Ename = "%", Aname = "%" }, new GenericTable { Iserial = 1, Code = "Value", Ename = "Value", Aname = "Value" } }; var currencyClient = new GlService.GlServiceClient(); currencyClient.GetGenericCompleted += (s, sv) => { CurrencyList = new ObservableCollection <CRUDManagerService.GenericTable>(); foreach (var item in sv.Result) { CurrencyList.Add(new CRUDManagerService.GenericTable().InjectFrom(item) as CRUDManagerService.GenericTable); } }; currencyClient.GetGenericAsync("TblCurrency", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname); var journalAccountTypeClient = new GlService.GlServiceClient(); journalAccountTypeClient.GetGenericCompleted += (s, sv) => { JournalAccountTypeList = sv.Result; }; journalAccountTypeClient.GetGenericAsync("TblJournalAccountType", "%%", "%%", "%%", "Iserial", "ASC", LoggedUserInfo.DatabasEname); PurchasePlanClient.GetTblMarkupProdAsync(0, int.MaxValue, "it.Iserial", null, null, LoggedUserInfo.DatabasEname); PurchasePlanClient.GetTblMarkupProdCompleted += (s, sv) => { MarkupList = new ObservableCollection <TblMarkupProd>(); foreach (var item in sv.Result) { MarkupList.Add(new TblMarkupProd().InjectFrom(item) as TblMarkupProd); } // MarkupList = sv.Result; }; SelectedMainRow = new TblDyeingOrderInvoiceHeaderViewModel { DocDate = DateTime.Now }; DyeingServiceClient.UpdateOrInsertDyeingOrderInvoiceHeaderCompleted += (s, sv) => { if (sv.Error != null) { MessageBox.Show(sv.Error.Message); } try { SelectedMainRow.InjectFrom(sv.Result); if (SelectedMainRow.Status == 0) { SelectedMainRow.VisPosted = true; } else { SelectedMainRow.VisPosted = false; } } catch (Exception) { } Loading = false; if (OpenMisc) { new MarkupTransProdChildWindow(this).Show(); OpenMisc = false; } }; PurchasePlanClient.UpdateOrInsertDyeingOrderInvoiceMarkupTransProdsCompleted += (s, x) => { var markup = new TblMarkupProd(); try { var row = SelectedMainRow.MarkUpTransList.ElementAt(x.outindex); if (row != null) { markup = row.TblMarkupProd1; } if (x.Result.Iserial == -1) { MessageBox.Show("This Markup Is Not Linked To Account"); row.TblMarkupProd1 = null; } else { SelectedMainRow.MarkUpTransList.ElementAt(x.outindex).InjectFrom(x.Result); if (row != null) { row.TblMarkupProd1 = markup; } } } catch (Exception) { } Loading = false; }; DyeingServiceClient.GetDyeingOrderInvoiceHeaderCompleted += (s, sv) => { Loading = false; MainRowList.Clear(); foreach (var variable in sv.Result.ToList()) { var newvendor = new Vendor(); newvendor.InjectFrom(sv.Vendors.FirstOrDefault(w => w.vendor_code == variable.Vendor)); var newrow = new TblDyeingOrderInvoiceHeaderViewModel(); newrow.InjectFrom(variable); newrow.VendorPerRow = newvendor; if (newrow.Status == 0) { newrow.VisPosted = true; } newrow.CurrencyPerRow = new GenericTable(); newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == variable.TblCurrency)); newrow.TblCurrency = variable.TblCurrency; MainRowList.Add(newrow); } }; DyeingServiceClient.GetDyeingOrderInvoiceDetailCompleted += (s, sv) => { foreach (var variable in sv.Result.ToList()) { var newrow = new TblDyeingOrderInvoiceDetailViewModel(); newrow.InjectFrom(variable); newrow.ServicePerRow = new TblService(); newrow.ColorPerRow = new TblColor(); newrow.ColorPerRow.Code = variable.TblColor1.Code; newrow.ServicePerRow.Code = variable.TblService1.Code; newrow.ServicePerRow.Ename = variable.TblService1.Ename; TransactionDetails.Add(newrow); } }; DyeingServiceClient.SearchDyeingOrderInvoiceCompleted += (s, sv) => { TransactionDetails.Clear(); foreach (var variable in sv.Result.ToList()) { var newrow = new TblDyeingOrderInvoiceDetailViewModel(); newrow.InjectFrom(variable); newrow.ServicePerRow = new TblService(); newrow.ColorPerRow = new TblColor(); newrow.ColorPerRow.Code = variable.ColorCode; newrow.ServicePerRow.Code = variable.ServiceCode; newrow.ServicePerRow.Ename = variable.ServiceName; newrow.SupplierInv = variable.SupplierInv; TransactionDetails.Add(newrow); } }; PurchasePlanClient.DyeingOrderInvoiceMarkupTransProdCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblMarkupTranProdViewModel(); newrow.InjectFrom(row); newrow.CurrencyPerRow = new GenericTable(); newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == row.TblCurrency)); newrow.TblCurrency = row.TblCurrency; newrow.TblMarkupProd1 = new TblMarkupProd(); newrow.TblMarkupProd1.InjectFrom(MarkupList.FirstOrDefault(w => w.Iserial == row.TblMarkupProd)); newrow.TblMarkupProd = row.TblMarkupProd; newrow.JournalAccountTypePerRow = JournalAccountTypeList.FirstOrDefault(w => w.Iserial == newrow.TblJournalAccountType); newrow.EntityPerRow = new GlService.Entity().InjectFrom(sv.entityList.FirstOrDefault(w => w.Iserial == row.EntityAccount && w.TblJournalAccountType == row.TblJournalAccountType)) as GlService.Entity; newrow.TblJournalAccountType = row.TblJournalAccountType; newrow.EntityAccount = row.EntityAccount; SelectedMainRow.MarkUpTransList.Add(newrow); } Loading = false; if (SelectedMainRow.MarkUpTransList.Count == 0) { AddNewMarkUpRow(false, true); } }; }
public ColorLinkViewModel() { if (!DesignerProperties.IsInDesignTool) { Client.GetAllBrandsCompleted += (s, sv) => { BrandsList = sv.Result; }; Client.GetAllBrandsAsync(LoggedUserInfo.Iserial); var seasonClient = new CRUD_ManagerServiceClient(); seasonClient.GetGenericCompleted += (s, sv) => { SeasonList = sv.Result; }; seasonClient.GetGenericAsync("TblLkpSeason", "%%", "%%", "%%", "Iserial", "ASC"); Client.GetTblColorCompleted += (s, sv) => { // ColorsList.Clear(); // GenericMapper.InjectFromObCollection(ColorsList, sv.Result); foreach (var row in sv.Result) { ColorsList.Add(new TblColor().InjectFrom(row) as TblColor); } Loading = false; DetailFullCount = sv.fullCount; }; Client.GetTblColorLinkCompleted += (s, sv) => { foreach (var row in sv.Result) { //if (!MainRowList.Contains(row.TblColor1)) //{ TblColor col = new TblColor(); col.Iserial = row.TblColor1.Iserial; col.Code = row.TblColor1.Code; col.Ename = row.TblColor1.Ename; col.Aname = row.TblColor1.Aname; col.PantonCode = row.PantonCode; MainRowList.Add(col); // } } Loading = false; FullCount = sv.fullCount; }; lkpClient.GetTblBrandSectionLinkCompleted += (s, sv) => { if (Copy) { BrandSectionListCopy.Clear(); foreach (var row in sv.Result) { BrandSectionListCopy.Add(row.TblLkpBrandSection1); } Copy = false; } else { BrandSectionList.Clear(); foreach (var row in sv.Result) { BrandSectionList.Add(row.TblLkpBrandSection1); } } Loading = false; }; Client.UpdateOrDeleteTblColorLinkCompleted += (s, ev) => { if (ev.Error != null) { } else { MainRowList.Clear(); GetMaindata(); } Loading = false; }; Client.CopyColorLinkCompleted += (s, sv) => { Loading = false; }; } }