// ReSharper disable once InconsistentNaming public LedgerAttachmentViewModel(TblLedgerHeaderViewModel Row) { HeaderRow = Row; MainRowList = new SortableCollectionView <GlLedgerAttachmentViewModel>(); SelectedMainRow = new GlLedgerAttachmentViewModel(); Glclient.GetTblLedgerHeaderAttachmentCompleted += (s, sv) => { MainRowList.Clear(); foreach (var row in sv.Result) { var newrow = new GlLedgerAttachmentViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; }; Glclient.GetTblLedgerHeaderAttachmentAsync(HeaderRow.Iserial); Glclient.UpdateOrInsertTblLedgerHeaderAttachmentCompleted += (s, x) => Glclient.GetTblLedgerHeaderAttachmentAsync(HeaderRow.Iserial); Glclient.DeleteTblLedgerHeaderAttachmentCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; }
public SearchChequeViewModel() { if (!IsDesignTime) { Glclient = new GlServiceClient(); MainRowList = new SortableCollectionView <TblBankCheque>(); SelectedMainRow = new TblBankCheque(); Glclient.CreateChequeCompleted += (s, sv) => GetMaindata(); Glclient.GetTblBankChequeCompleted += (s, sv) => { foreach (var row in sv.Result) { MainRowList.Add(row); } if (Bank != 0 && ValuesObjects != null && (!MainRowList.Any() && ValuesObjects.ContainsKey("Cheque0"))) { var res = MessageBox.Show("This Cheque is Not Found Do You Want To Create It ?", "Create Cheque", MessageBoxButton.OKCancel); if (res == MessageBoxResult.OK) { Glclient.CreateChequeAsync(Bank, (long)ValuesObjects.FirstOrDefault(w => w.Key == "Cheque0").Value, 1, LoggedUserInfo.DatabasEname); } } Loading = false; FullCount = sv.fullCount; }; } }
public TblBrandStoreTargetHeaderViewModel() { MainRowList = new SortableCollectionView <TblBrandStoreTargetDetailViewModel>(); MainRowList.CollectionChanged += MainRowList_CollectionChanged; _client.GetTblBrandStoreTargetHeaderCompleted += (s, sv) => { Glserial = 0; MainRowList.Clear(); if (sv.Result != null) { foreach (var tblBrandStoreTargetDetail in sv.Result.TblBrandStoreTargetDetails.OrderBy(x => x.TblStore1.code)) { Glserial = tblBrandStoreTargetDetail.Glserial; var row = new TblBrandStoreTargetDetailViewModel().InjectFrom(tblBrandStoreTargetDetail) as TblBrandStoreTargetDetailViewModel; row.StorePerRow = new StoresForBrand { Iserial = tblBrandStoreTargetDetail.TblStore1.iserial, Code = tblBrandStoreTargetDetail.TblStore1.code, Ename = tblBrandStoreTargetDetail.TblStore1.ENAME, Aname = tblBrandStoreTargetDetail.TblStore1.aname }; MainRowList.Add(row); } Glserial = sv.Result.Glserial; } foreach (var variable in sv.Stores.OrderBy(x => x.Code)) { if (MainRowList.FirstOrDefault(x => x.Tblstore == variable.Iserial) == null) { MainRowList.Add(new TblBrandStoreTargetDetailViewModel { Glserial = Glserial, StorePerRow = variable, Qty = 1 }); } } TotalAmount = MainRowList.Sum(x => x.Amount); TotalQty = MainRowList.Sum(x => x.Qty); }; }
public ExcuseRuleViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <TblExcuseRuleViewModel>(); SelectedMainRow = new TblExcuseRuleViewModel(); AttService.AxPeriodsCompleted += (s, sv) => { PeriodList = sv.Result; }; AttService.AxPeriodsAsync(); AttService.ExcuseTypeCompleted += (s, sv) => { ExcuseTypeList = sv.Result; }; AttService.ExcuseTypeAsync(); AttService.GetTblExcuseRuleCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblExcuseRuleViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; AttService.UpdateOrInsertTblExcuseRuleCompleted += (s, x) => { var savedRow = (TblExcuseRuleViewModel)MainRowList.ElementAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; AttService.DeleteTblExcuseRuleCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
public ServiceCodingViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <TblServiceViewModel>(); SelectedMainRow = new TblServiceViewModel(); var tblAssetsTypeclient = new CRUD_ManagerServiceClient(); tblAssetsTypeclient.GetGenericAsync("TblServiceGroup", "%%", "%%", "%%", "Iserial", "ASC"); tblAssetsTypeclient.GetGenericCompleted += (s, sv) => { ServiceGroupList = sv.Result; }; Client.GetTblServiceCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblServiceViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.UpdateOrInsertTblServiceCompleted += (s, x) => { var savedRow = (TblServiceViewModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; Client.DeleteTblServiceCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
public AttachmentModel(string TableName, int masterId) { this.TableName = TableName; this.MasterId = masterId; MainRowList = new SortableCollectionView <AttachmentViewModel>(); SelectedMainRow = new AttachmentViewModel(); assistanceClient.GetAttachmentCompleted += (s, sv) => { MainRowList.Clear(); foreach (var row in sv.Result) { var newrow = new AttachmentViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; }; assistanceClient.UpdateOrInsertAttachmentCompleted += (s, sv) => { FolderPath = "/Uploads" + "/" + sv.FolderPath; var folderName = FolderPath;// + "/" + Style.SeasonPerRow.Ename + "_" + Style.Brand + "_" + Style.SectionPerRow.Ename; //var counter = 0; foreach (var item in MainRowList) { if (item.Iserial == 0) { var oldItem = sv.Result.FirstOrDefault(r => r.OrginalFileName == item.OrginalFileName); if (oldItem != null) { item.Path = oldItem.Path; item.FolderPath = folderName; item.UploadFile(item.AttachmentPerRow); } //counter++; } } }; assistanceClient.GetAttachmentAsync(TableName, MasterId); //assistanceClient.UpdateOrInsertAttachmentCompleted += (s, x) => assistanceClient.GetAttachmentAsync(TableName); assistanceClient.DeleteAttachmentCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; }
public SearchAssetsTransactionViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <TblAssetsTransactionViewModel>(); SelectedMainRow = new TblAssetsTransactionViewModel(); Client.GetTblAssetsTransactionCompleted += (s, sv) => { foreach (var row in sv.Result) { if (sv.Stores != null) { var newrow = new TblAssetsTransactionViewModel { StorePerRow = sv.Stores.FirstOrDefault( x => x.Code == row.StoreCode && x.Organization == row.OrganizationId) }; var tempEmp = sv.employees.FirstOrDefault(x => x.EMPLID == row.Empid); if (tempEmp != null) { newrow.EmpPerRow = new EmployeesView { Emplid = row.Empid, Name = tempEmp.name }; } newrow.AssetPerRow.InjectFrom(row.TblAsset); newrow.InjectFrom(row); MainRowList.Add(newrow); } } Loading = false; FullCount = sv.fullCount; if (MainRowList.Any() && (SelectedMainRow == null || SelectedMainRow.Iserial == 0)) { SelectedMainRow = MainRowList.FirstOrDefault(); } if (Export) { Export = false; //var handler = ExportCompleted; //if (handler != null) handler(this, EventArgs.Empty); //ExportGrid.ExportExcel("Style"); } }; GetMaindata(); } }
public FingerPrintTransactionViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <FingerPrintTransactionModel>(); SelectedMainRow = new FingerPrintTransactionModel(); GetItemPermissions(PermissionItemName.FingerPrintTransaction.ToString()); Client.GetFingerPrintTransactionCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new FingerPrintTransactionModel(); newrow.InjectFrom(row); newrow.StorePerRow = sv.storesAllCompanies.FirstOrDefault( x => x.Code == row.StoreCode && x.Organization == row.Company); newrow.EmpPerRow = sv.empList.FirstOrDefault(x => x.Emplid == row.UserId); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.UpdateOrInsertFingerPrintTransactionCompleted += (s, x) => { var savedRow = (FingerPrintTransactionModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; Client.DeleteFingerPrintTransactionCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.GlSerial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
public CostDimChildViewModel(LedgerHeaderViewModel ledgerHeaderViewModel) { if (!IsDesignTime) { LedgerHeaderViewModel = ledgerHeaderViewModel; GetItemPermissions(PermissionItemName.Account.ToString()); Glclient = new GlServiceClient(); MainRowList = new SortableCollectionView <TblCostDimDetailViewModel>(); SelectedMainRow = new TblCostDimDetailViewModel(); Glclient.GetTblCostDimSetupHeaderForAccountCompleted += (s, sv) => { if (sv.Result != null) { foreach (var row in sv.Result.TblCostDimDetails) { var newrow = new TblCostDimDetailViewModel(); newrow.InjectFrom(row); newrow.CostCenterPerRow = row.TblCostCenter1; MainRowList.Add(newrow); } } Loading = false; if (MainRowList.Any() && (SelectedMainRow == null)) { SelectedMainRow = MainRowList.FirstOrDefault(); } if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Glclient.SaveTblCostDimHeaderCompleted += (s, ev) => { if (ev.Error != null) { MessageBox.Show(ev.Error.Message); } try { ledgerHeaderViewModel.SelectedDetailRow.TblCostDimHeader = ev.Result; ledgerHeaderViewModel.SaveMainRow(); } catch (Exception) { } }; GetMaindata(); } }
public TransferMsgViewModel() { if (!DesignerProperties.IsInDesignTool) { GetItemPermissions(PermissionItemName.TransferMsg.ToString()); MainRowList = new SortableCollectionView <TblTransferMsgViewModel>(); SelectedMainRow = new TblTransferMsgViewModel(); Client.GetTblTransferMsgCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblTransferMsgViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.UpdateOrInsertTblTransferMsgCompleted += (s, x) => { var savedRow = (TblTransferMsgViewModel)MainRowList.GetItemAt(x.outindex); if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; Client.DeleteTblTransferMsgCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
public MissionViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <TblMissionViewModel>(); SelectedMainRows = new ObservableCollection <TblMissionViewModel>(); AttService.MissionTypeCompleted += (x, y) => { Ccmission = y.Result; }; AttService.MissionTypeAsync(); AttService.UpdateAndInsertTblMissionCompleted += (x, y) => { var savedRow = (TblMissionViewModel)MainRowList.GetItemAt(y.outindex); if (savedRow != null) { savedRow.InjectFrom(y.Result); } }; AttService.GetTblMissionCompleted += (x, y) => { foreach (var row in y.Result) { var newrow = new TblMissionViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } }; AttService.DeleteTblMissionCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
private void BtnPrepareSample_OnClick(object sender, RoutedEventArgs e) { var child = new AdvanceSampleRequestChildWindow(_styleViewModel); var list = new SortableCollectionView <TblSalesOrderViewModel>(); foreach (var row in _styleViewModel.SelectedMainRow.TempDetailsList.Where( x => x.TblRequestForSample == _viewModel.SelectedMainRow.Iserial)) { list.Add(row); } _styleViewModel.SelectedMainRow.DetailsList = list; child.Show(); }
public SearchAssetViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); MainRowList = new SortableCollectionView <TblAssetsViewModel>(); SelectedMainRow = new TblAssetsViewModel(); Client.GetTblAssetsCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblAssetsViewModel(); if (row.TblAssetsType1 != null) { newrow.AssetTypePerRow.InjectFrom(row.TblAssetsType1); } if (row.TblHardDisk1 != null) { newrow.HardDiskPerRow.InjectFrom(row.TblHardDisk1); } if (row.TblMemory1 != null) { newrow.MemoryPerRow.InjectFrom(row.TblMemory1); } if (row.TblProcessor1 != null) { newrow.ProcessorPerRow.InjectFrom(row.TblProcessor1); } newrow.Pending = sv.PendingAssets.Any(x => x == row.Iserial); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; }; GetMaindata(); } }
public SearchPurchaseOrdersViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); MainRowList = new SortableCollectionView <CRUD_ManagerServicePurchaseOrderDto>(); SelectedMainRow = new CRUD_ManagerServicePurchaseOrderDto(); Client.GetPurchaseOrderJournalsCompleted += (s, sv) => { foreach (var row in sv.Result) { MainRowList.Add(row); } Loading = false; }; } }
public DocumentationFilesViewModel() { MainRowList = new SortableCollectionView <TblDocumentationFilesViewModel>(); SelectedMainRow = new TblDocumentationFilesViewModel(); Client.GetDocumentationFilesCompleted += (s, sv) => { MainRowList.Clear(); foreach (var row in sv.Result) { var newrow = new TblDocumentationFilesViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; }; Client.GetDocumentationFilesAsync(); }
public SearchVendorViewModel() { if (!DesignerProperties.IsInDesignTool) { MainRowList = new SortableCollectionView <Vendor>(); SelectedMainRow = new Vendor(); Client.GetVendorsCompleted += (s, sv) => { foreach (var row in sv.Result) { MainRowList.Add(row); } Loading = false; //FullCount = sv.fullCount; }; // GetMaindata(); } }
public SearchRetailStyleViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); MainRowList = new SortableCollectionView <viewstyle>(); SelectedMainRow = new viewstyle(); Client.GetviewstyleCompleted += (s, sv) => { foreach (var row in sv.Result) { MainRowList.Add(row); } Loading = false; }; } }
public EmpLeavingTransactionForManagmentViewModel() { if (!DesignerProperties.IsInDesignTool) { GetItemPermissions(PermissionItemName.EmpLeavingTransactionForManagment.ToString()); MainRowList = new SortableCollectionView <TblEmpLeavingTransactionViewModel>(); SelectedMainRow = new TblEmpLeavingTransactionViewModel(); Client.GetEmpLeavingTransactionCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblEmpLeavingTransactionViewModel(); newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.DeleteEmpLeavingTransactionCompleted += (s, ev) => { if (ev.Error != null) { throw ev.Error; } Loading = false; var oldrow = MainRowList.FirstOrDefault(x => x.Iserial == ev.Result); if (oldrow != null) { MainRowList.Remove(oldrow); } }; GetMaindata(); } }
public BrandStoreTargetManagmentViewModel() { if (!DesignerProperties.IsInDesignTool) { GetItemPermissions(PermissionItemName.BrandStoreTargetForManagement.ToString()); MainRowList = new SortableCollectionView <TblBrandStoreTargetHeaderForManagmentViewModel>(); SelectedMainRow = new TblBrandStoreTargetHeaderForManagmentViewModel(); Client.GetTblBrandStoreTargetHeaderForManagmentCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblBrandStoreTargetHeaderForManagmentViewModel(); newrow.ItemDownloadDefPerRow = new TblItemDownLoadDef(); newrow.ItemDownloadDefPerRow = row.TblItemDownLoadDef1; newrow.InjectFrom(row); MainRowList.Add(newrow); } Loading = false; FullCount = sv.fullCount; if (FullCount == 0 && MainRowList.Count == 0) { AddNewMainRow(false); } }; Client.UpdateOrInsertTblBrandStoreTargetHeaderCompleted += (s, x) => { var savedRow = (TblBrandStoreTargetHeaderForManagmentViewModel)MainRowList.GetItemAt(x.outindex); Loading = false; if (savedRow != null) { savedRow.InjectFrom(x.Result); } }; GetMaindata(); } }
public SearchGroupsViewModel() { if (!DesignerProperties.IsInDesignTool) { Client = new CRUD_ManagerServiceClient(); MainRowList = new SortableCollectionView <TblGROUP1>(); SelectedMainRow = new TblGROUP1(); Client.GetRetailGroupsCompleted += (s, sv) => { foreach (var row in sv.Result) { MainRowList.Add(row); } Loading = false; FullCount = sv.fullCount; }; //GetMaindata(); } }