public AddIssueSubTypeViewModel(List<IssueSubType> selectedIssueSubTypes, IEnumerable<IssueType> issueTypes) { var idList = (from x in issueTypes select x.Id).ToList(); mSelectedSubIssueSubTypes = selectedIssueSubTypes; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetIssueSubTypesAvailableForIssueTypesCompleted += (s1, e1) => { IssueSubTypes = e1.Result.OrderBy(x=>x.Ordinal).ToList(); foreach (var issueType in IssueSubTypes) { if ((from x in mSelectedSubIssueSubTypes where x.Id == issueType.Id select x).FirstOrDefault() != null) { issueType.Checked = true; } } mIssueSubTypesLoaded = true; RaiseLoaded(); }; cmsWebServiceClient.GetIssueSubTypesAvailableForIssueTypesAsync(idList); OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler); }
public AddEditPropertyListNameViewModel(AddEditPropertyListNameDialog view, PropertyListName propertyListName, CommonUtils.Operation operation) { View = view; mPropertyListName = propertyListName; OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModifyConfig); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); if (operation == CommonUtils.Operation.Update) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetPropertyListNameCompleted += (s1, e1) => { mPropertyListName = e1.Result; LoadPropertyListNames(mPropertyListName.PropertyListId); mExistingPropertyListNamesLoaded = true; FireLoaded(); }; cmsWebServiceClient.GetPropertyListNameAsync(mPropertyListName.Id); } else { LoadPropertyListNames(mPropertyListName.PropertyListId); } }
public AddEditUnitViewUnit(AddEditUnitDialog view, Unit unit, CommonUtils.Operation operation) { View = view; mUnit = unit; LoadUnits(); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModifyConfig); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); if (operation == CommonUtils.Operation.Update) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetUnitCompleted += (s1, e1) => { mUnit = e1.Result; FireLoaded(); }; cmsWebServiceClient.GetUnitAsync(mUnit.Id); } else { FireLoaded(); } }
public AddIssueTypeViewModel(List<IssueType> selectedIssueTypes) { if (DesignerProperties.IsInDesignTool) { return; } mSelectedIssueTypes = selectedIssueTypes; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetIssueTypesCompleted += (s1, e1) => { IssueTypes = e1.Result; foreach (var issueType in IssueTypes) { if ((from x in mSelectedIssueTypes where x.Id == issueType.Id select x).FirstOrDefault() != null) { issueType.Checked = true; } } mIssueTypesLoaded = true; RaiseLoaded(); }; cmsWebServiceClient.GetIssueTypesAsync(); OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler); }
public MyProfileViewModel(User user) { mUser = user; if (user.UserPreference == null) { const int width = 315; user.UserPreference = new UserPreference(); user.UserPreference.AdminPanelWidth = width; user.UserPreference.ControlPanelWidth = width; user.UserPreference.DocumentPanelWidth = 630; user.UserPreference.ElectricalPanelWidth = width; user.UserPreference.InstrumentPanelWidth = width; user.UserPreference.IssuePanelWidth = width; user.UserPreference.MechanicalPanelWidth = width; user.UserPreference.MobilePanelWidth = width; user.UserPreference.PipePanelWidth = width; } CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.UserIsADefaultUserCompleted += (s1, e1) => { UserIsADefaultUser = e1.Result; }; cmsWebServiceClient.UserIsADefaultUserAsync(mUser.Id); }
public AddEditIssueFinancialVarianceCodeModel(CommonUtils.Operation operation, int itemId) { CompositionInitializer.SatisfyImports(this); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); if (operation == CommonUtils.Operation.Add) { mIssueFinancialVarianceCode = new IssueFinancialVarianceCode(); } else if (operation == CommonUtils.Operation.Update) { var varianceId = itemId; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetIssueFinancialVarianceCodeCompleted += (s1, e1) => { mIssueFinancialVarianceCode = e1.Result; if (DataLoaded != null) { mIssueFinancialVarianceCode = e1.Result; DataLoaded(); } }; cmsWebServiceClient.GetIssueFinancialVarianceCodeAsync(varianceId); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.EmptyReportsFolderCompleted += cmsWebServiceClient_EmptyReportsFolderCompleted; cmsWebServiceClient.EmptyReportsFolderAsync(CMS.AppSetting.DownloadAttachmentsPathRoot); }
public AddEditCoefficientModel(CommonUtils.Operation operation, int itemId) { CompositionInitializer.SatisfyImports(this); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); if (operation == CommonUtils.Operation.Add) { var groupId = itemId; mCoefficient = new CalculatedRatingCoefficient(); //mCoefficient.CoefficientGroupId = groupId; } else if (operation == CommonUtils.Operation.Update) { var CoefficientId = itemId; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetCalculatedRatingCoefficientCompleted += (s1, e1) => { mCoefficient = e1.Result; if (DataLoaded != null) { mCoefficient = e1.Result; DataLoaded(); } }; cmsWebServiceClient.GetCalculatedRatingCoefficientAsync(CoefficientId); } }
public MobilePlantControlViewModel(int equipmentId) { CompositionInitializer.SatisfyImports(this); SaveButtonCommand = new DelegateCommand<object>(SaveButtonHandler, CanModify); RemoveButtonCommand = new DelegateCommand<object>(RemoveButtonHandler, CanDelete); ExpiryPickerButton = new DelegateCommand<object>(ExpiryButtonHandler, CanDelete); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetMobilePlantCompleted += cmsWebServiceClient_GetMobilePlantCompleted; cmsWebServiceClient.GetMobilePlantAsync(equipmentId); cmsWebServiceClient.GetMobilePlantTypesCompleted += cmsWebServiceClient_GetMobilePlantTypesCompleted; cmsWebServiceClient.GetMobilePlantTypesAsync(false); //MobileHirers cmsWebServiceClient.GetMobileHirersCompleted += cmsWebServiceClient_GetMobileHirersCompleted; cmsWebServiceClient.GetMobileHirersAsync(); //Owners cmsWebServiceClient.GetMobileOwnersCompleted += cmsWebServiceClient_GetMobileOwnersCompleted; cmsWebServiceClient.GetMobileOwnersAsync(); cmsWebServiceClient.GetUpperEquipmentsCompleted += cmsWebServiceClient_GetUpperEquipmentsCompleted; cmsWebServiceClient.GetUpperEquipmentsAsync(); Areas = new ObservableCollection<Area>(from x in CMS.Cache.Areas where x.IsActive && x.SiteId == CMS.AppSetting.DefaultSiteId select x); }
private void GetDomainUsers() { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EventHandler<GetActiveDirectoryUsersCompletedEventArgs> eventHandler = null; eventHandler = (s1, e1) => { var activeDirectoryContacts = e1.Result; UsersDataGrid.ItemsSource = activeDirectoryContacts; cmsWebServiceClient.GetActiveDirectoryUsersCompleted -= eventHandler; //sort by Contact column UsersDataGrid.SortDescriptors.Clear(); ColumnSortDescriptor descriptor = new ColumnSortDescriptor(); descriptor.Column = (GridViewDataColumn)UsersDataGrid.Columns["Contact"]; descriptor.SortDirection = ListSortDirection.Ascending; UsersDataGrid.SortDescriptors.Add(descriptor); IsBusyIndicator.IsBusy = false; }; cmsWebServiceClient.GetActiveDirectoryUsersCompleted += eventHandler; cmsWebServiceClient.GetActiveDirectoryUsersAsync(); }
public AddEditExistingControlSystemComponentAlarmPropertyViewModel(int componentTypePropertyId) { //edit OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModify); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); Properties = new List<ControlSystemAlarmProperty>(); //Load ControlSystem Properties types EventHandler<GetAllControlSystemAlarmPropertiesCompletedEventArgs> fetchCompleted = (s, e) => { Properties = e.Result; cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertyCompleted += (s2, e2) => { if (Properties.Count > 0) { SelectedProperty = (from x in Properties where x.Id == e2.Result.ComponentTypeId select x).FirstOrDefault(); } mControlSystemComponentTypeAlarmProperty = e2.Result; Loaded(); }; cmsWebServiceClient.GetControlSystemComponentTypeAlarmPropertyAsync(componentTypePropertyId); }; cmsWebServiceClient.GetAllControlSystemAlarmPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetAllControlSystemAlarmPropertiesAsync(); }
public IssueFilesViewModel(Issue issue) { CompositionInitializer.SatisfyImports(this); mIssue = issue; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetAttachmentTypesCompleted += (s, e) => { mAttachmentTypes = e.Result; cmsWebServiceClient.GetIssueFilesCompleted += (s1, e1) => { mIssue.IssueFiles.Clear(); foreach (IssueFile attachment in e1.Result) { attachment.Issue = mIssue;//this brings i the distribution list we need to set padlock. attachment.AttachmentTypes = mAttachmentTypes; mIssue.IssueFiles.Add(attachment); } if (DataLoaded != null) { DataLoaded(); } RaisePropertyChanged("Attachments"); }; cmsWebServiceClient.GetIssueFilesAsync(mIssue.Id); }; cmsWebServiceClient.GetAttachmentTypesAsync(); AddButton = new DelegateCommand<object>(AddButtonHandler, CanAddHandler); DeleteButton = new DelegateCommand<object>(DeleteButtonHandler, CanDeleteHandler); ExportButton = new DelegateCommand<object>(ExportButtonHandler, x => true); }
public AddClassificationViewModel(List<IssueClassification> selectedIssueSubTypes, IEnumerable<IssueType> issueTypes) { mSelectedClassifications = selectedIssueSubTypes; var ids = (from x in issueTypes select x.Id).ToList(); var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetIssueClassificationsAvailableForIssueTypesCompleted += (s1, e1) => { IssueClassifications = e1.Result; foreach (IssueClassification classification in IssueClassifications) { if ((from x in mSelectedClassifications where x.Id == classification.Id select x).FirstOrDefault() != null) { classification.Checked = true; } } mLoaded = true; RaiseLoaded(); }; cmsWebServiceClient.GetIssueClassificationsAvailableForIssueTypesAsync(ids); OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler); }
public static Task LoadIssueCategoriesCache() { var task = new TaskCompletionSource<bool>(); if (CMS.Cache.IssueCategories == null) { CMS.Cache.IssueCategories = new CmsObservableCollection<IssueCategory>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); DateTime now = DateTime.Now; System.Diagnostics.Debug.WriteLine("LoadIssueCategoriesCache First {0}", now.ToString("G")); //IssueCategories cee.GetIssueCategoriesCompleted += (s4, e4) => { CMS.Cache.IssueCategories = new ObservableCollection<IssueCategory>(e4.Result.OrderBy(x => x.Ordinal)); var elapsed = DateTime.Now - now; System.Diagnostics.Debug.WriteLine("LoadIssueCategoriesCache: {0} {1}", elapsed.TotalSeconds, DateTime.Now); task.SetResult(true); }; cee.GetIssueCategoriesAsync(); } else { task.SetResult(true); return task.Task; //Already loaded } return task.Task; }
public AddControlSystemRevisionHistoryDialog(int controlSystemId, string tabText) { InitializeComponent(); mHistory.IsSystemMessage = false; this.Title = string.Format("Add Revision History - Control System {0}: " , tabText); mHistory.ControlSystemId = controlSystemId; mModel = new ControlSystemRevisionHistoryViewModel(mHistory); DataContext = mModel; CmsWebServiceClient mCmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); mCmsWebServiceClient.GetControlSystemRelatedIssuesCompleted += (s1, e1) => { //Get list of issue ids assigned to the pipe List<IssueRelatedControlSystem> relatedIssues = e1.Result; List<int> issueIds = (from x in relatedIssues select x.IssueId).ToList(); mCmsWebServiceClient.GetIssuesAsync(issueIds); mCmsWebServiceClient.GetIssuesCompleted += (s2, e2) => { //Bing list of issues to IssuesGridView issueComboBox.ItemsSource = e2.Result; }; }; mCmsWebServiceClient.GetControlSystemRelatedIssuesAsync(controlSystemId); }
public static Task<bool> GetIssueRiskRelatedObjects() { var task = new TaskCompletionSource<bool>(); if (CMS.Cache.IssueRiskRelatedObjects == null) { CMS.Cache.IssueRiskRelatedObjects = new IssueRiskRelatedObjects(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); DateTime now = DateTime.Now; System.Diagnostics.Debug.WriteLine("InterlockRiskRelatedObjectsCache First {0}", now.ToString("G")); //ReportLinks cee.GetIssueRiskRelatedObjectsCompleted += (s, e) => { CMS.Cache.IssueRiskRelatedObjects = e.Result; var elapsed = DateTime.Now - now; System.Diagnostics.Debug.WriteLine("InterlockRiskRelatedObjectsCache: {0}", elapsed.TotalSeconds); task.SetResult(true); }; cee.GetIssueRiskRelatedObjectsAsync(); } else { task.SetResult(true); return task.Task; //Already loaded } return task.Task; }
public static Task LoadAreasCache() { var task = new TaskCompletionSource<bool>(); if (CMS.Cache.Areas == null) { CMS.Cache.Areas = new ObservableCollection<Area>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); DateTime now = DateTime.Now; System.Diagnostics.Debug.WriteLine("LoadAreasCache First {0}", now.ToString("G")); //AREAS cee.GetAreasCompleted += (s1, e1) => { CMS.Cache.Areas = new ObservableCollection<Area>(e1.Result.OrderBy(x => x.AreaNumber)); var elapsed = DateTime.Now - now; System.Diagnostics.Debug.WriteLine("LoadAreasCache: {0}", elapsed.TotalSeconds); task.SetResult(true); }; cee.GetAreasAsync(); } else { System.Diagnostics.Debug.WriteLine("-----------------------------------------------------------"); System.Diagnostics.Debug.WriteLine("LoadAreasCache: ALREADY LOADED !!!"); System.Diagnostics.Debug.WriteLine("-----------------------------------------------------------"); task.SetResult(true); return task.Task; //Already loaded } return task.Task; }
public AddDocumentRevisionHistoryDialog(int documentId) { InitializeComponent(); mHistory.DocumentId = documentId; mModel = new DocumentRevisionHistoryViewModel(mHistory); DataContext = mModel; CmsWebServiceClient mCmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); mCmsWebServiceClient.GetDocumentRelatedIssuesCompleted += (s1, e1) => { //Get list of issue ids assigned to the pipe List<IssueRelatedDocument> relatedIssues = e1.Result; List<int> issueIds = (from x in relatedIssues select x.IssueId).ToList(); mCmsWebServiceClient.GetIssuesAsync(issueIds); mCmsWebServiceClient.GetIssuesCompleted += (s2, e2) => { //Bing list of issues to IssuesGridView issueComboBox.ItemsSource = e2.Result; }; }; mCmsWebServiceClient.GetDocumentRelatedIssuesAsync(documentId); }
private void AddExistingMobilePlantComponentProperty(NodeView nodeView) { int electricalEquipmentComponentTypeId = nodeView.Id; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetMobilePlantComponentTypeCompleted += (s, e) => { AddEditExistingMobilePlantComponentPropertyDialog dialog = new AddEditExistingMobilePlantComponentPropertyDialog(e.Result); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { EventHandler<AddMobilePlantComponentTypePropertyCompletedEventArgs> addCompleted = null; addCompleted = (s2, eventArgs) => { MobilePlantComponentTypeProperty pcpt = eventArgs.Result; if (pcpt != null) { NodeView child = new NodeView(nodeView) { Id = pcpt.Id, Name = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Name, Description = dialog.MobilePlantComponentTypeProperty.MobilePlantProperty.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.MobilePlantComponentTypeProperty, HasChildren = false, SortField = dialog.MobilePlantComponentTypeProperty.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted -= addCompleted; }; cmsWebServiceClient.AddMobilePlantComponentTypePropertyCompleted += addCompleted; MobilePlantComponentTypeProperty electricalEquipmentComponentTypeProperty = new MobilePlantComponentTypeProperty { MobilePlantComponentTypeId = electricalEquipmentComponentTypeId, MobilePlantPropertyId = dialog.MobilePlantComponentTypeProperty.MobilePlantPropertyId, Ordinal = dialog.MobilePlantComponentTypeProperty.Ordinal }; cmsWebServiceClient.AddMobilePlantComponentTypePropertyAsync(electricalEquipmentComponentTypeProperty); } }; }; cmsWebServiceClient.GetMobilePlantComponentTypeAsync(electricalEquipmentComponentTypeId); }
public InstrumentPropertiesViewModel(InstrumentComponent instrumentEquipmentComponent) { mInstrumentComponent = instrumentEquipmentComponent; Models = new List<Model>(); LastInspectedCommand = new DelegateCommand<object>(LastInspectedHandler, CanModify); NextInspectionCommand = new DelegateCommand<object>(NextInspectionHandler, CanModify); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetManufacturersCompleted += (s, e) => { mManufacturers = e.Result; RaisePropertyChanged("Manufacturers"); RaisePropertyChanged("Manufacturer"); if (mInstrumentComponent.ManufacturerId.HasValue) { LoadModels(mInstrumentComponent.ManufacturerId.Value); } else if (Loaded != null) { Loaded(); Loaded = null; } }; cmsWebServiceClient.GetManufacturersAsync((int)CommonUtils.EquipmentTypeCode.INSTR); }
public AddMobilePlantViewModel() { CompositionInitializer.SatisfyImports(this); mMobilePlant = new MobilePlant(); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); //MobileHirers cmsWebServiceClient.GetMobileHirersCompleted += cmsWebServiceClient_GetMobileHirersCompleted; cmsWebServiceClient.GetMobileHirersAsync(); //Owners cmsWebServiceClient.GetMobileOwnersCompleted += cmsWebServiceClient_GetMobileOwnersCompleted; cmsWebServiceClient.GetMobileOwnersAsync(); //Types cmsWebServiceClient.GetMobilePlantTypesCompleted += cmsWebServiceClient_GetMobilePlantTypesCompleted; cmsWebServiceClient.GetMobilePlantTypesAsync(); Areas = new ObservableCollection<Area>(from x in CMS.Cache.Areas where x.IsActive && x.SiteId == CMS.AppSetting.DefaultSiteId select x); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); }
public AddEditExistingElectricalComponentPropertyViewModel(int componentTypePropertyId) { OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModify); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); Properties = new List<ElectricalEquipmentProperty>(); //Load Electrical Properties types EventHandler<GetAllElectricalEquipmentPropertiesCompletedEventArgs> fetchCompleted = (s, e) => { Properties = e.Result; cmsWebServiceClient.GetElectricalComponentTypePropertyCompleted += (s2, e2) => { if (Properties.Count > 0) { SelectedProperty = (from x in Properties where x.Id == e2.Result.ElectricalEquipmentPropertyId select x).FirstOrDefault(); } mComponentTypeId = e2.Result.ElectricalEquipmentComponentTypeId; mOrdinal = e2.Result.Ordinal; DataLoaded(); }; cmsWebServiceClient.GetElectricalComponentTypePropertyAsync(componentTypePropertyId); }; cmsWebServiceClient.GetAllElectricalEquipmentPropertiesCompleted += fetchCompleted; cmsWebServiceClient.GetAllElectricalEquipmentPropertiesAsync(); }
public AddElectricalRevisionHistoryDialog(int equipmentId, string tabText) { InitializeComponent(); this.Title = string.Format("Add Revision History - Electrical Equipment {0} ", tabText); mHistory.ElectricalEquipmentId = equipmentId; mModel = new ElectricalRevisionHistoryViewModel(mHistory); DataContext = mModel; CmsWebServiceClient mCmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); mCmsWebServiceClient.GetElectricalEquipmentRelatedIssuesCompleted += (s1, e1) => { //Get list of issue ids assigned to the pipe List<IssueRelatedElectricalEquipment> relatedIssues = e1.Result; List<int> issueIds = (from x in relatedIssues select x.IssueId).ToList(); mCmsWebServiceClient.GetIssuesAsync(issueIds); mCmsWebServiceClient.GetIssuesCompleted += (s2, e2) => { //Bing list of issues to IssuesGridView issueComboBox.ItemsSource = e2.Result; }; }; mCmsWebServiceClient.GetElectricalEquipmentRelatedIssuesAsync(equipmentId); }
public static Task<bool> ControlComponentExist(string componentName) { var task = new TaskCompletionSource<bool>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.ControlSystemComponentExistsCompleted += (s, e) => task.SetResult(e.Result); cee.ControlSystemComponentExistsAsync(componentName); return task.Task; }
public static Task<List<int>> CanIssueStatusBeDisabled(int issueStatusId) { var task = new TaskCompletionSource<List<int>>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.CanIssueStatusBeDisabledCompleted += (s, e) => task.SetResult(e.Result); cee.CanIssueStatusBeDisabledAsync(issueStatusId); return task.Task; }
public static Task<bool> ElectricalComponentExist(string electricalComponentName) { var task = new TaskCompletionSource<bool>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.ElectricalComponentExistCompleted += (s, e) => task.SetResult(e.Result); cee.ElectricalComponentExistAsync(electricalComponentName); return task.Task; }
public IssueKpiControlViewModel(Issue issue, IssueKpiControl view) { mView = view; mIssue = issue; CompositionInitializer.SatisfyImports(this); mTimer.Interval = TimeSpan.FromMilliseconds(500); mTimer.Tick += RefreshKpiTable; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); IssueKpis = new List<IssueKpiTableViewModel>(); AddButtonCommand = new DelegateCommand<object>(AddButtonHandler, CanExecuteAddButtonHandler); RemoveButtonCommand = new DelegateCommand<object>(RemoveButtonHandler, CanExecuteRemoveButtonHandler); ShowHideBaselineCommand = new DelegateCommand<object>(ShowHideBaselineHandler, x => true); IsBusy = true; cmsWebServiceClient.GetIssueKpiVarianceCodesCompleted += (s1, e1) => { IssueKpiVarianceCodes = e1.Result; RaisePropertyChanged("IssueKpiVarianceCodes"); cmsWebServiceClient.GetIssueKpisCompleted += (s, e) => { mIssue.IssueKpis = e.Result; DatabaseLoader.GetIssueSettings().ContinueWith(getIssueFinancialSettingsTask => { CMS.UiFactory.StartNew(() => { mIssueSetting = getIssueFinancialSettingsTask.Result; foreach (var issueKpi in mIssue.IssueKpis) { var financialTableItem = new IssueKpiTableViewModel(issueKpi, IssueKpiVarianceCodes, view, CanUserModifyActuals(), mIssueSetting); mIssueKpis.Add(financialTableItem); } mIssueKpis = mIssueKpis.OrderBy(x => x.Date).ToList(); RaisePropertyChanged("IssueKpis"); //mDictionary = Utils.BuildDictionaryForCollection(mIssue.IssueFinancials.Select(x => x.Id).ToList()); mIssue.ModifiedObjects.KpisModified = true; if (view.ViewModelLoaded != null) { view.ViewModelLoaded(); } IsBusy = false; }); }); }; cmsWebServiceClient.GetIssueKpisAsync(mIssue.Id); }; cmsWebServiceClient.GetIssueKpiVarianceCodesAsync(); }
public static Task<bool> DocumentExist(string documentName) { var task = new TaskCompletionSource<bool>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.GetQuickDocumentByNameCompleted += (s, e) => task.SetResult(e.Result != null); cee.GetQuickDocumentByNameAsync(documentName); return task.Task; }
public PreferredEquipmentListViewModel(CommonUtils.EquipmentTypeCode equipmentTypeCode) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetPreferredEquipmentsCompleted += (s, e) => { PreferredEquipments = e.Result; }; cmsWebServiceClient.GetPreferredEquipmentsAsync(equipmentTypeCode); }
public static Task<bool> ControlSystemExist(string name) { var efo = new EquipmentFilterObject { Name = name }; var task = new TaskCompletionSource<bool>(); var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cee.GetQuickControlSystemsCompleted += (s, e) => task.SetResult(e.Result.Any()); cee.GetQuickControlSystemsAsync(efo); return task.Task; }