void SaveExecute(object param) { try { CurrentContract.CHANGED_BY = DB.OracleSession.UserName; CurrentContract.CHANGED_ON = DateTime.Now; if (CurrentContract.CONTRACT_ID == 0) { ContractTarget.Add(CurrentContract); contractListViewModel.SetToNewlyAdded(CurrentContract); } else { ContractTarget.Update(CurrentContract); } CurrentContract.Modified = false; if (_view.IsInView) { contractListViewModel.EnablePicker = true; } RaisePropertyChanged("IsNotAddingNew"); } catch (Exception x) { _view.ShowMsg(x.ToString()); } }
void DeleteExecute(object param) { try { ContractTarget.Remove(CurrentContract); contractListViewModel.Search(); RaisePropertyChanged("IsNotAddingNew"); } catch (Exception x) { _view.ShowMsg(x.ToString()); } }
public void SetItemDetails() { if (currentGroupItem == null || currentGroupItem.IsSpoof) { SelectedBrand = null; SelectedFreq = null; SelectedDeliveryMethod = null; SelectedPlatform = null; SelectedSpecialist = null; ContractName = null; if (ReportTypes != null) { ReportTypes.ForEach((thislist, thisreport) => RemoveWeakEventListener(thisreport, ReportListener)); ReportTypes = new ObservableReportTypes(safeReportTypes, true); ReportTypes.ForEach((thislist, thisreport) => AddWeakEventListener(thisreport, ReportListener)); } ClientLocations = null; RaisePropertyChanged("ReportTypes"); ReportText = "Select Report Types..."; return; } if (/*DB.Connnected &&*/ ReportTypes == null) { ReportTypes = new ObservableReportTypes(ReportTypesTarget.GetReportTypesAsList()); safeReportTypes = new ObservableReportTypes(ReportTypes, true); } if (CurrentGroupItem.ContractID == null) { ContractName = "No Contract assigned."; } else { Contract contract = ContractTarget.GetByContractID((int)CurrentGroupItem.ContractID); if (contract == null) { ContractName = "No contract found for this Group."; } else { ContractName = contract.DESCR; } } AddWeakEventListener(CurrentGroupItem, EncryptListener); IgReports = InvoiceGrpReportsTarget.GetById(currentGroupItem.InvoiceGrpId); foreach (ReportType reportType in ReportTypes) { foreach (InvoiceGrpReport igr in IgReports) { if (igr.REPORT_TYPE_ID == reportType.REPORT_TYPE_ID) { reportType.IsSelected = true; } else { reportType.IsSelected = false; } } } RaisePropertyChanged("ReportTypes"); base.ViewCore.UpdateCB(); SelectedSpecialist = (Specialists.First(ss => ss.Id == currentGroupItem.BillingSpecialistID) as BillingSpecialist); SelectedFreq = (Freqs.First(f => f.FREQ == currentGroupItem.BillingFrequency) as Freq); SelectedPlatform = (Platforms.First(p => p.PLATFORM == currentGroupItem.PrimaryPlatform) as Platform); SelectedDeliveryMethod = (DeliveryMethods.First(dm => dm.TheDeliveryMethod == currentGroupItem.DeliveryMethod) as DeliveryMethod); SelectedBrand = (Brands.FirstOrDefault(b => b.BRAND == currentGroupItem.Brand) as Brand); SelectedRemitTo = (RemitTos.First(r => r.REMIT_TO_ID == currentGroupItem.RemitToID) as RemitTo); SelectedInvoiceStyle = (InvoiceStyles.First(i => i.INVOICE_STYLE == currentGroupItem.InvoiceStyle) as InvoiceStyle); SelectedInvoiceGrpStatus = (InvoiceGrpStatuss.First(i => i.INVOICE_GRP_STATUS == currentGroupItem.InvoiceGroupStatus) as InvoiceGrpStatus); if (ClientLocations != null) { ClientLocations.CollectionChanged -= ClientLocCollectionChanged; } ClientLocations = ExtClientTarget.FetchLocations(CurrentGroupItem.InvoiceGrpId, true); ClientLocations.CollectionChanged += ClientLocCollectionChanged; currentGroupItem.Modified = false; GroupVM.EnablePicker = true; }