private void Start_btn_Click(object sender, EventArgs e) { Invoke(_clearBeforeRun); //FOREACH SELECTED METRIC VALIDATION RUN SERVICE. foreach (var MetricsValidation in this.DataChecksModelView.SelectedMetricsValidations) { //Inc num of services to run this._numOfValidationsToRun++; //Getting Time Period MetricsValidation.Value.TimePeriod = GetTimePeriodFromTimePicker(); //Run service using current configuration if (MetricsValidation.Value.RunHasLocal) { ((DataChecksBase)MetricsValidation.Value). RunUsingLocalConfig(DataChecksModelView.GetSelectedValidationTypes(), this.AccountsCheckedListBox.CheckedItems, EventsHandlers); this._runnigServices++; } //Run service using external configuration //else // ((DataChecksBase)MetricsValidation.Value). // RunUsingExternalConfig(this.DataChecksModelView.SelectedValidationsTypes, this.AccountsCheckedListBox.SelectedItems); } }
private List <AccountServiceElement> GetProfilesFromConfiguration(string pathKey, ComboBox profilesCombo) { List <AccountServiceElement> serviceElement = new List <AccountServiceElement>(); try { AccountElement account; if (DataChecksModelView.TryGetAccountFromExtrernalConfig(ConfigurationManager.AppSettings.Get(pathKey), -1, out account)) { foreach (AccountServiceElement service in account.Services) { if (service.Options.ContainsKey("ProfileName")) { serviceElement.Add(service); int n = profilesCombo.Items.Add(service.Options["ProfileName"]); } } } } catch { //Show error msg } return(serviceElement); }
void child_instance_StateChanged(object sender, Edge.Core.Services.ServiceStateChangedEventArgs e) { Edge.Core.Services.ServiceInstance instance = (Edge.Core.Services.ServiceInstance)sender; Invoke(_updateProgressBar, new object[] { this.progressBar, 0, true }); Invoke(_updateProgressBar, new object[] { this.progressBar, 60, true }); //Invoke(_setLabelText, new object[] { ProgressBarTxt, string.Format("{0}-{1}", instance.Configuration.Name, e.StateAfter) }); string log = string.Format("State Changed : {0} - Account ID: {2} - Service Channel ID: {1} ", e.StateAfter, instance.Configuration.GetOption("ChannelList", false), instance.Configuration.GetOption("AccountsList", false) == null ? instance.AccountID.ToString() : instance.Configuration.GetOption("AccountsList", false)); Invoke(_updateLogBox, new object[] { log }); if (e.StateAfter == ServiceState.Ready) { instance.Start(); } if (e.StateAfter == ServiceState.Ended) { //Update current running services counter //Invoke(_incCounter, new object[] { this._runnigServices, -1 }); if (instance.Configuration.Options.ContainsKey("OnEnd") && (instance.Configuration.Options["OnEnd"].ToString().Equals("GetValidationResults"))) { //Get Validations Results List <ValidationResult> newResults = DataChecksModelView.GetValidationResultsByInstance(instance); //TO DO : Add results to validation results view. if (newResults.Capacity > 0) { Invoke(_updateResults, new object[] { newResults }); //Invoke(_setButton, new object[] { this.report_btn, true, true }); } else { //Writing To PMS validation log Invoke(_updateLogBox, new object[] { "Validation results werent found in DB !!" }); } } } }
public DataChecksForm() { #region Init Deligate functions /**************************************************************************/ _updateProgressBar = new UpdateProgressBar(updateProgressBarState); _updateResults = new UpdateResults(updateResults); _updateLogBox = new UpdateLogBox(writeLog); _clearBeforeRun = new ClearBeforeRun(clearOnStart); _setButton = new SetButtonVisibility(setButtonVisibility); _incCounter = new IncCounter(IncreaseCounter); _setLabelText = new SetLabelText(SetLabel); /**************************************************************************/ #endregion DataChecksModelView = new DataChecksModelView(); EventsHandlers = new Dictionary <string, Object>(); //Adding Service Events Handler functions #region Attaching Services Events EventsHandlers.Add(Const.EventsTypes.ParentOutcomeReportedEvent, new EventHandler(instance_OutcomeReported)); //EventsHandlers.Add(Const.EventsTypes.ChildOutcomeReportedEvent, new EventHandler(instance_OutcomeReported)); EventsHandlers.Add(Const.EventsTypes.ParentStateChangedEvent, new EventHandler <Edge.Core.Services.ServiceStateChangedEventArgs>(instance_StateChanged)); EventsHandlers.Add(Const.EventsTypes.ChildStateChangedEvent, new EventHandler <ServiceStateChangedEventArgs>(child_instance_StateChanged)); EventsHandlers.Add(Const.EventsTypes.ChildServiceRequested, new EventHandler <ServiceRequestedEventArgs>(instance_ChildServiceRequested)); #endregion InitializeComponent(); //Load Validation Types from configuration DataChecksModelView.LoadValidationTypesItems(this.ValidationTypes.Nodes); //Load Metrics Validations from configuration DataChecksModelView.LoadMetricsValidationsItems(this.MerticsValidations.Nodes); this.LogBox.Multiline = true; }
/*================================================================================*/ // Selected Application Event // private void application_cb_SelectedValueChanged(object sender, EventArgs e) { string pathKey = string.Empty; if (((ComboBox)sender).SelectedItem.Equals(Const.AdMetricsConst.EdgeApp)) { pathKey = Const.AdMetricsConst.EdgeProductionPathKey; } else { pathKey = Const.AdMetricsConst.SeperiaProductionPathKey; } AccountsCheckedListBox.Items.Clear(); this.profile_cb.Items.Clear(); this.profile_cb.Text = "Select Profile"; //Loading production configuration DataChecksModelView.LoadProductionConfiguration(pathKey); //Loading Accounts from Data Base DataChecksModelView.LoadAccountsFromDB(application_cb.SelectedItem.ToString(), AccountsCheckedListBox, DataChecksModelView.AvailableAccountList); //Getting Profiles from configuration if (!DataChecksModelView.TryGetProfilesFromConfiguration(pathKey, profile_cb, DataChecksModelView.Profiles)) { DataChecksModelView.TryGetProfilesFromConfiguration(Const.AdMetricsConst.SeperiaProductionPathKey, profile_cb, DataChecksModelView.Profiles); } rightSidePanel.Enabled = true; //Getting and setting profiles from selected configuration _profilesServiceElement = GetProfilesFromConfiguration(pathKey, this.profile_cb); clearOnStart(); }