public bool InteractWith(TargetItem target) { switch (type) { case ItemType.Weapon: Sacrifice s = target.gameObject.GetComponent<Sacrifice>(); if (s) { s.Kill(); } break; case ItemType.Container: Liquid l = target.gameObject.GetComponent<Liquid>(); if (l) { l.Collect(); gameObject.GetComponent<Cup>().Fill(); } break; case ItemType.Decorative: DecorationSpace d = target.gameObject.GetComponent<DecorationSpace>(); if (d) { d.Decorate(this); } break; } return false; }
void Update () { if (Input.GetMouseButton(0)) { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast (mousePos, Vector3.zero); if (hit.collider && hit.collider.gameObject.tag == "Draggable") { heldItem = hit.collider.gameObject.GetComponent<ToolItem>(); } if (heldItem != null) { bool intersecting = false; GameObject[] interactables = GameObject.FindGameObjectsWithTag("Interactable"); for (int i = 0; i < interactables.Length; i++) { if (DoObjectsIntersect(heldItem.gameObject, interactables[i])) { intersecting = true; targetItem = interactables[i].GetComponent<TargetItem>(); if (targetItem != null && !targetItem.activated) { heldItem.InteractWith(targetItem); } } } if (intersecting == false) { targetItem = null; } } } else { if (heldItem != null && targetItem != null) { heldItem.AddPoints(); } targetItem = null; heldItem = null; } }
/// <summary> /// Performs all validations needed to update a primary metric /// </summary> /// <param name="target">Modified target</param> /// <param name="existingTarget">Existing target</param> public virtual void ValidateMetricTargetEditRequest(TargetItem target, Target existingTarget) { var currentDate = TimeZoneUtility.GetCurrentTimestamp(); DateTime currentMonthStartDate = new DateTime(currentDate.Year, currentDate.Month, 1); //If the target entry method is daily,then the actual entry method should also be daily. if (target.TargetEntryMethodId == Constants.TargetEntryMethodDaily) { if (target.TrackingMethodId != Constants.TrackingMethodDaily) { throw new NDMSBusinessException(Constants.TargettEntryMethodMethodValidationErrorMessage); } } if (!existingTarget.IsActive) { throw new NDMSBusinessException(Constants.TargetNotFound); } //check if target has started capturing actuals bool actualExists = CheckIfTargetHasStartedCapturingDailyActuals(existingTarget.Id); bool isDailyTargetsApplicable = target.TrackingMethodId == Constants.TrackingMethodDaily; if ((target.MetricId != existingTarget.MetricId) && actualExists) { throw new NDMSBusinessException(Constants.TargetMetricChangeErrorMessage); } targetMetricValidator.ValidateMetricForScorecardKPI(target); if (target.MetricType == MetricType.Primary) { //method to validate whether a primary metric already exists in the given time period targetMetricValidator.ValidatePrimaryMetricCount(target); } else if (target.MetricType == MetricType.Secondary) { // Method to validate whether only maximum allowed number of secondary metrics exists // in the given time period targetMetricValidator.ValidateSecondaryMetricCount(target); } //If the Scorecard has started capturing Actual, //then the Stretch Goal cannot be removed if ((target.IsStretchGoalEnabled == false) && (existingTarget.IsStretchGoalEnabled != target.IsStretchGoalEnabled)) { if (actualExists) { throw new NDMSBusinessException(Constants.StretchGoalOptionRemovalErrorMessage); } } if (existingTarget.EffectiveStartDate < currentMonthStartDate) { if (existingTarget.CascadeFromParent != target.CascadeFromParent) { throw new NDMSBusinessException(Constants.EditCascadingOptionValidationErrorMessage); } } if (target.CascadeFromParent) { targetMetricValidator.ValidateCascadedMetric(target); } else { if (target.EffectiveStartDate != existingTarget.EffectiveStartDate) { if (actualExists) { throw new NDMSBusinessException(Constants.EffectiveStartDateErrorMessage); } //block when effective start date is a past month date if (target.EffectiveStartDate < currentMonthStartDate) { throw new NDMSBusinessException(Constants.TargetStartDatePastErrorMessage); } } if (target.EffectiveEndDate != existingTarget.EffectiveEndDate) { //block effective end date is not a future date if (target.EffectiveEndDate < currentDate) { throw new NDMSBusinessException(Constants.TargetEndDatePastErrorMessage); } } ValidateTargetDates(target.EffectiveStartDate, target.EffectiveEndDate, target.CalendarYearId.Value); } var errors = new List <string>(); var calendarYear = yearRepository.Get(target.CalendarYearId.Value); //Check whether monthly targets entered falls //between the selected start date and end date ValidateTargetMonths(target.EffectiveStartDate, target.EffectiveEndDate, target.MonthlyTargets); //check to restrict the update of Monthly Targets for past months ValidateMonthlyTargetUpdate(target.MonthlyTargets, existingTarget.MonthlyTargets); //check whether Daily Targets entered are valid ValidateDailyTargets(target.MonthlyTargets, target.EffectiveStartDate, target.EffectiveEndDate); //check whether Stretch Goal Targets must be on par or beat the monthly target //based on the Goal type of the Metric if (target.IsStretchGoalEnabled.Value) { ValidateStrechGoalTarget(target.MetricId.Value, target.MonthlyTargets); } //set stretch goal value in monthlyTargets list to null if stretch goal is disabled else { target.MonthlyTargets.ForEach(x => x.StretchGoalValue = null); } }
public TargetItem StoreGeneralItem(TargetItem target, ISourceValues tagsBody) { return(StoreGeneralItem(target.Head(), target.Part(), target.Code(), target.Seed(), tagsBody)); }
public void InvokeEfsBackup() { // start Log.i("Start Backup Cal & IMEI."); this.FbMode = FBMode.Backup; _jobCount = 0; foreach (var m in this.TargetItems) { _jobCount++; Task.Factory.StartNew(x => { // prepare TargetItem tm = x as TargetItem; tm.Initialize(); // check diag port tm.StatusText = "<Backup Cal & IMEI> check port"; if (tm.CurrentPort.Kind != SerialportWatcher.PortKind.Diagnostic) { tm.StatusText = "<Backup Cal & IMEI> Error - No diagnostic port"; Log.e("{0}/{1} {2}", tm.Id, tm.CurrentPort.ToString(), tm.StatusText); return; } // load protocol lib. tm.StatusText = "<Backup Cal & IMEI> Load protocol lib."; if (!tm.PrepareTargetWrapper(Helper.ProtocolDllPath)) { tm.StatusText = "<Backup Cal & IMEI> Error - Load protocol lib."; Log.e("{0}/{1} {2}", tm.Id, tm.CurrentPort.ToString(), tm.StatusText); return; } try { // read version info tm.StatusText = "<Backup Cal & IMEI> Check Version is valid."; const int intervalTime = 200; const int totalWaitTime = 30 * 1000; Stopwatch timer = new Stopwatch(); int cnt = 0; // invoke backup efs timer.Restart(); while (totalWaitTime > timer.ElapsedMilliseconds) { cnt += 10; Dictionary <string, string> result; if (tm.Tif.DiagRequest(string.Format("{0}version{0}{0}", (char)TDiagMethod.Get), out result, tm.CurrentPort.Name) != 0) { if (result.Count > 0) { timer.Reset(); break; } tm.StatusText = @"<Backup Cal & IMEI> Modem is not ready ..."; } else { tm.StatusText = @"<Backup Cal & IMEI> Yet, no response"; } tm.FileProgress = cnt % 100; System.Threading.Thread.Sleep(intervalTime); tm.TotalProgress = (int)(100 * timer.ElapsedMilliseconds / totalWaitTime); } if (timer.ElapsedMilliseconds >= totalWaitTime) { tm.StatusText = "<Backup Cal & IMEI> Error - Version check is invalid."; Log.e("{0}/{1} {2}", tm.Id, tm.CurrentPort.ToString(), tm.StatusText); return; } // end tm.StatusText = "<Backup Cal & IMEI> Run Backup command"; Dictionary <string, string> res; cnt = tm.Tif.DiagRequest(string.Format("{0}efsbackup{0}{0}", (char)TDiagMethod.Run), out res, tm.CurrentPort.Name); if (cnt == 0) { tm.StatusText = "<Backup Cal & IMEI> Error - Backup command return error."; Log.e("{0}/{1} {2}", tm.Id, tm.CurrentPort.ToString(), tm.StatusText); return; } tm.StatusText = "<Backup Cal & IMEI> Backup is finished successfully."; } catch (Exception e) { tm.StatusText = "<Backup Cal & IMEI> Exception:" + e.ToString(); Log.e("{0}/{1} {2}", tm.Id, tm.CurrentPort.ToString(), tm.StatusText); } finally { tm.ReleaseTargetWrapper(); _jobCount--; if (_jobCount == 0 && this.FbMode != FBMode.None) { this.FbMode = FBMode.None; } } }, m); } }
void UpdateJobList(TargetItem aItem = null) { if (this.FbMode != FBMode.None) { return; } var jlist = new List <TargetJob>(); bool existDown = this.Items.Any(x => x.Use && x.Protocol == QProtocol.Firehose); if (this.CCMOnly) { jlist.Add(TargetJob.Ready); jlist.Add(TargetJob.Diag_VersionInfo); if (this.SkipEraseEfs) { jlist.Add(TargetJob.Diag_EFS_Backup); } if (existDown) { jlist.Add(TargetJob.Diag_RebootEDL); jlist.Add(TargetJob.WaitPort_Qloader); jlist.Add(TargetJob.Dload_All); } jlist.Add(TargetJob.WaitPort_Diag); jlist.Add(TargetJob.Diag_VersionInfo); if (this.SkipEraseEfs) { jlist.Add(TargetJob.Diag_EFS_ClearFlag); } } else { jlist.Add(TargetJob.Ready); jlist.Add(TargetJob.Diag_VersionInfo); jlist.Add(TargetJob.TargetPrepare); if (this.SkipEraseEfs) { jlist.Add(TargetJob.Diag_EFS_Backup); } if (existDown) { jlist.Add(TargetJob.Diag_RebootEDL); jlist.Add(TargetJob.WaitPort_Qloader); } if (this.UseMicomUpdate) { if (!existDown) { jlist.Add(TargetJob.Diag_RebootEDL); jlist.Add(TargetJob.WaitPort_Qloader); } jlist.Add(TargetJob.Dload_Micom); jlist.Add(TargetJob.WaitPort_Diag); jlist.Add(TargetJob.Diag_VersionInfo); jlist.Add(TargetJob.Diag_MicomUpdate1); if (existDown) { jlist.Add(TargetJob.Diag_RebootEDL); jlist.Add(TargetJob.WaitPort_Qloader); } } if (existDown) { jlist.Add(TargetJob.Dload_All); } else { jlist.Add(TargetJob.Diag_RebootNormal); } jlist.Add(TargetJob.WaitPort_Diag); jlist.Add(TargetJob.Diag_VersionInfo); if (this.UseMicomUpdate) { jlist.Add(TargetJob.Diag_MicomUpdate2); jlist.Add(TargetJob.Diag_MicomResult); if (this.SkipEraseEfs) // jwoh changed job list { jlist.Add(TargetJob.Diag_EFS_ClearFlag); } if (this.SelModel != 0) // jwoh add GB key erase function [ { jlist.Add(TargetJob.Diag_MicomKeyErase); if ((CheckBuildVersion & 0x40) != 0) { jlist.Add(TargetJob.Diag_MicomKeyEraseCheck); } } // jwoh add GB key erase function ] jlist.Add(TargetJob.Diag_RebootNormal); jlist.Add(TargetJob.WaitPort_Diag); jlist.Add(TargetJob.Diag_VersionInfo); // jlist.Add(TargetJob.Diag_PlatformID); } else { if (this.SkipEraseEfs) { jlist.Add(TargetJob.Diag_EFS_ClearFlag); } if (this.UseModeChange) { jlist.Add(TargetJob.Diag_DebugOff); } } } jlist.Add(TargetJob.End); if (aItem == null) { foreach (var titem in this.TargetItems) { titem.Steps = jlist; titem.Step = 0; } } else { aItem.Steps = jlist; aItem.Step = 0; } }
/// <summary> /// Construit une nouvelle instance de ScopeItemPanel /// </summary> /// <param name="index">Index du panel</param> /// <param name="item">TargetItem à afficher</param> public ScopeItemPanel(TargetItem item) : this() { Display(item); }
private Result <MoneyPaymentSum, string> GetExcludeIncome(IEnumerable <ResultPair> results, TargetItem target) { Result <MoneyPaymentSum, string> taxableIncome = GetSumResultUtils.GetSumMoneyPayment(results, TargetFilters.TargetHeadFunc(target.Head()), ArticleFilters.TaxExcludeHealthFunc); return(taxableIncome); }
/// <summary> /// Method to convert Target item DTO to Target entity /// </summary> /// <param name="targetItem">Target item DTO to be converted</param> /// <param name="Parent target Id">Identifier of the parent target</param> /// <param name="loggedInUserId">Logged In UserId</param> /// <returns>Target entity</returns> public static Target ConvertTargetItemDTOToTarget(TargetItem targetItem, int?parentTargetId, int loggedInUserId) { DateTime curTimestamp = TimeZoneUtility.GetCurrentTimestamp(); var target = new Target() { ScorecardId = targetItem.ScorecardId, KPIId = targetItem.KPIId.Value, MetricId = targetItem.MetricId.Value, MetricType = targetItem.MetricType, EffectiveStartDate = targetItem.EffectiveStartDate, EffectiveEndDate = targetItem.EffectiveEndDate, CascadeFromParent = targetItem.CascadeFromParent, ParentTargetId = parentTargetId, IsStretchGoalEnabled = targetItem.IsStretchGoalEnabled ?? false, TrackingMethodId = targetItem.TrackingMethodId ?? Constants.TrackingMethodDaily, TargetEntryMethodId = targetItem.TargetEntryMethodId, GraphPlottingMethodId = targetItem.GraphPlottingMethodId, MTDPerformanceTrackingMethodId = targetItem.MTDPerformanceTrackingMethodId, CascadedMetricsTrackingMethodId = targetItem.CascadedMetricsTrackingMethodId, AnnualTarget = targetItem.AnnualTarget, IsCascaded = false, IsActive = true, IsCopiedMetric = false, CalendarYearId = targetItem.CalendarYearId.Value, CreatedOn = curTimestamp, LastModifiedOn = curTimestamp, CreatedBy = loggedInUserId, //Need to update with logged in user in future LastModifiedBy = loggedInUserId, //Need to update with logged in user in future }; target.TargetHistory = new List <TargetHistory>() { ConvertTargetToTargetHistory(target) }; // Iterate monthly targets and insert List <MonthlyTarget> monthlyTargets = new List <MonthlyTarget>(); foreach (var monthlyTarget in targetItem.MonthlyTargets) { if (monthlyTarget.GoalValue != null || monthlyTarget.DailyRateValue != null) { MonthlyTarget mthlyTarget = ConvertMonthlyTargetItemToMonthlyTargetEntity (monthlyTarget, loggedInUserId); mthlyTarget.MonthlyTargetHistory = new List <MonthlyTargetHistory>() { ConvertMonthlyTargetToMonthlyTargetHistory(mthlyTarget) }; mthlyTarget.DailyTargets = new List <DailyTarget>(); if (monthlyTarget.DailyTargets != null) { foreach (var dailyTargetItem in monthlyTarget.DailyTargets) { if (!dailyTargetItem.IsHoliday && !dailyTargetItem.IsOutofRange) { DailyTarget dailyTarget = ConvertDailyTargetItemToDailyTargetEntity(dailyTargetItem, mthlyTarget, loggedInUserId); mthlyTarget.DailyTargets.Add(dailyTarget); } } } monthlyTargets.Add(mthlyTarget); } } target.MonthlyTargets = monthlyTargets; return(target); }
private Result <MoneyAmountSum, string> GetSocialsPart(IEnumerable <ResultPair> results, TargetItem target) { ConfigCode taxPartCode = (ConfigCode)ArticleCodeCz.FACT_TAX_BASE_ADVANCE_SOCIAL; Result <MoneyAmountSum, string> taxPartAmount = FindResultUtils.FindMoneyInsuranceBasisValue(results, TargetFilters.TargetCodeFunc(taxPartCode)); return(taxPartAmount); }
public void AddTargetItem(TargetItem item) { targetItemList.Add(item); }
public void RemoveTargetItem(TargetItem item) { targetItemList.Remove(item); }
private void DeleteFromTarget(TargetItem childNode) { var parentNode = (Target)_mainTree.SelectedNode.Parent; TargetItemBaseReadWrite element = childNode.TargetItemDefinition; if (element is ActionElementReadWrite) { var anyAction = new AnyAction(); parentNode.Nodes.Add(anyAction); parentNode.TargetDefinition.Actions.ItemsList = null; parentNode.TargetDefinition.Actions.IsAny = true; } else if (element is ResourceElementReadWrite) { var anyResource = new AnyResource(); parentNode.Nodes.Add(anyResource); parentNode.TargetDefinition.Resources.ItemsList = null; parentNode.TargetDefinition.Resources.IsAny = true; } else if (element is SubjectElementReadWrite) { var anySubject = new AnySubject(); parentNode.Nodes.Add(anySubject); parentNode.TargetDefinition.Subjects.ItemsList = null; parentNode.TargetDefinition.Subjects.IsAny = true; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void CreateTargetItem(object sender, EventArgs args) { if (_mainTree.SelectedNode is AnySubject) { var anyNode = (AnySubject)_mainTree.SelectedNode; var targetNode = (Target)anyNode.Parent; int idx = targetNode.Nodes.IndexOf(anyNode); targetNode.Nodes.RemoveAt(idx); var matchCollection = new TargetMatchReadWriteCollection(); matchCollection.Add( new SubjectMatchElementReadWrite( Consts.Schema1.InternalFunctions.StringEqual, new AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Somebody", XacmlVersion.Version11), //TODO: check version new SubjectAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, Consts.Schema1.SubjectElement.ActionSubjectId, "", "", XacmlVersion.Version11), XacmlVersion.Version11)); //TODO: check version var targetItem = new SubjectElementReadWrite(matchCollection, XacmlVersion.Version11); //TODO: check version var targetItemNode = new TargetItem(targetItem); targetNode.Nodes.Insert(idx, targetItemNode); targetNode.TargetDefinition.Subjects.IsAny = false; targetNode.TargetDefinition.Subjects.ItemsList.Add(targetItem); targetItemNode.NodeFont = new Font(_mainTree.Font, FontStyle.Bold); _mainTree.SelectedNode = targetItemNode; } else if (_mainTree.SelectedNode is AnyAction) { var anyActionNode = (AnyAction)_mainTree.SelectedNode; var targetNode = (Target)anyActionNode.Parent; int idx = targetNode.Nodes.IndexOf(anyActionNode); targetNode.Nodes.RemoveAt(idx); var matchCollection = new TargetMatchReadWriteCollection { new ActionMatchElementReadWrite( Consts.Schema1.InternalFunctions.StringEqual, new AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "DoSomething", XacmlVersion.Version11), //TODO: check version new ActionAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, Consts.Schema1.ActionElement.ActionId, "", XacmlVersion.Version11), XacmlVersion.Version11) }; var action = new ActionElementReadWrite(matchCollection, XacmlVersion.Version11); //TODO: check version var actionNode = new TargetItem(action); targetNode.Nodes.Insert(idx, actionNode); targetNode.TargetDefinition.Actions.IsAny = false; targetNode.TargetDefinition.Actions.ItemsList.Add(action); actionNode.NodeFont = new Font(_mainTree.Font, FontStyle.Bold); _mainTree.SelectedNode = actionNode; } else if (_mainTree.SelectedNode is AnyResource) { var anyNode = (AnyResource)_mainTree.SelectedNode; var targetNode = (Target)anyNode.Parent; int idx = targetNode.Nodes.IndexOf(anyNode); targetNode.Nodes.RemoveAt(idx); var matchCollection = new TargetMatchReadWriteCollection { new ResourceMatchElementReadWrite( Consts.Schema1.InternalFunctions.StringEqual, new AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Something", XacmlVersion.Version11), //TODO: check version new ResourceAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, Consts.Schema1.ResourceElement.ResourceId, "", XacmlVersion.Version11), XacmlVersion.Version11) }; var targetItem = new ResourceElementReadWrite(matchCollection, XacmlVersion.Version11); //TODO: check version var targetItemNode = new TargetItem(targetItem); targetNode.Nodes.Insert(idx, targetItemNode); targetNode.TargetDefinition.Resources.IsAny = false; targetNode.TargetDefinition.Resources.ItemsList.Add(targetItem); targetItemNode.NodeFont = new Font(_mainTree.Font, FontStyle.Bold); _mainTree.SelectedNode = targetItemNode; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mainTree_BeforeSelect(object sender, TreeViewCancelEventArgs e) { // Check if the control have been modified if (_mainPanel.Controls.Count != 0) { if (!(_mainPanel.Controls[0] is ContextCustomControls.XmlViewer)) { var baseControl = _mainPanel.Controls[0] as CustomControls.BaseControl; _mainTree.SelectedNode.NodeFont = new Font(_mainTree.Font, FontStyle.Regular); NoBoldNode oNode = null; var policySet = baseControl as CustomControls.PolicySet; if (policySet != null) { oNode = new PolicySet(policySet.PolicySetElement); } else { var rule = baseControl as CustomControls.Rule; if (rule != null) { oNode = new Rule(rule.RuleElement); } else { var targetItem = baseControl as CustomControls.TargetItem; if (targetItem != null) { TargetItemBaseReadWrite element = targetItem.TargetItemBaseElement; oNode = new TargetItem(element); } else { var obligations = baseControl as CustomControls.Obligations; if (obligations != null) { oNode = new Obligations(obligations.ObligationsElement); } else { var attribute = baseControl as ContextCustomControls.Attribute; if (attribute != null) { oNode = new Attribute(attribute.AttributeElement); } else { var resource = baseControl as ContextCustomControls.Resource; if (resource != null) { oNode = new Resource(resource.ResourceElement); } } } } } } if (oNode != null) { _mainTree.SelectedNode = oNode; _mainTree.SelectedNode.Text = oNode.Text; } } } }
private bool ExistTargetByHeadAndPartAndCode(TargetItem targetItem) { return(Keys().FirstOrDefault((s) => (s.IsEqualByCodePlusHeadAndPart(targetItem))) != null); }
protected override IEnumerable <ResultPack> EvaluateArticleResults(TargetItem evalTarget, ConfigBase evalConfig, ISourceValues evalValues, Period evalPeriod, IPeriodProfile evalProfile, IEnumerable <ResultPair> evalResults) { return(EvaluateUtils.DecoratedError(ARTICLE_DESCRIPTION_ERROR_FORMAT, EXCEPTION_RESULT_NONE_TEXT)); }
private Result <MoneyAmountSum, string> GetGeneralBase(IEnumerable <ResultPair> results, TargetItem target) { ConfigCode taxBaseCode = (ConfigCode)ArticleCodeCz.FACT_TAX_BASE_ADVANCE; Result <MoneyAmountSum, string> taxBaseAmount = FindResultUtils.FindMoneyTaxingBasisValue(results, TargetFilters.TargetCodeFunc(taxBaseCode)); return(taxBaseAmount); }
/// <summary> /// Construit une nouvelle instance de TargetItemPanel /// </summary> /// <param name="index">Index du panel</param> /// <param name="item">TagItem à afficher</param> public TargetItemPanel(TargetItem item, bool isNoAllocation = false) : this() { Display(item, isNoAllocation); }
private Result <MoneyAmountSum, string> GetTaxableIncome(IEnumerable <ResultPair> results, TargetItem target) { ConfigCode incomeTaxingCode = (ConfigCode)ArticleCodeCz.FACT_TAX_INCOMES_WITHHOLD_GENERAL; Result <MoneyAmountSum, string> taxableIncome = FindResultUtils.FindMoneyTransferIncomeValue(results, TargetFilters.TargetCodeFunc(incomeTaxingCode)); return(taxableIncome); }
public EvalValuesResultBuilder(TargetItem evalTarget, IEnumerable <ResultPair> evalResults) : base(CONCEPT_RESULT_INVALID_TEXT) { InternalTarget = evalTarget; InternalValues = evalResults; }
public ScopeItemPanel(TargetItem item, bool isCustomized) : this() { Display(item, isCustomized); }
private Result <MoneyPaymentSum, string> GetSumPayments(MoneyPaymentSum agr, TargetItem resultTarget, MoneyPaymentValue resultValue) { return(Result.Ok <MoneyPaymentSum, string>(agr.Aggregate(resultValue.Payment))); }
private Result <TaxableIncomeSum, string> GetTaxableIncome(IEnumerable <ResultPair> results, TargetItem target) { ConfigCode incomeTaxingCode = (ConfigCode)ArticleCodeCz.FACT_TAX_INCOMES_GENERAL; Result <TaxableIncomeSum, string> taxableIncome = GetSumResultUtils.GetSumIncomeTaxGeneral(results, TargetFilters.TargetCodeFunc(incomeTaxingCode), ArticleFilters.SelectAllFunc); return(taxableIncome); }
public ResultBuilder(TargetItem evalTarget, IEnumerable <ResultPair> evalResults) : base(evalTarget, evalResults) { }
Timer SendDebugtimer = new System.Timers.Timer(); // jwoh add User/Factory mode private void SerialportWatcher_SerialPortsChangedEvent(bool aInserted, SerialportWatcher.PortInfo aChangedPort) { this.UIThread(() => { if (this.FbMode == FBMode.None) { if (aInserted) { if (aChangedPort != null) { if (aChangedPort.Kind == SerialportWatcher.PortKind.Diagnostic || aChangedPort.Kind == SerialportWatcher.PortKind.QDLoader) { var titem = new TargetItem(_id, this); titem.CurrentPort = aChangedPort; this.TargetItems.Add(titem); Log.i("ADD Target Items1: ID:{0}, Port:{1}", _id, titem.CurrentPort.Caption); UpdateJobList(titem); _id++; // jwoh add User/Factory mode [ if ((this.SelBoard == 1) && (this.DLEndpopup == false) && (this.IsIdle)) { SendDebugtimer.Interval = 800; SendDebugtimer.Elapsed += new ElapsedEventHandler(timer_SendDebugon); SendDebugtimer.Start(); } // jwoh add User/Factory mode ] } } else { foreach (var port in SerialportWatcher.Ports) { if (port.Kind == SerialportWatcher.PortKind.Diagnostic || port.Kind == SerialportWatcher.PortKind.QDLoader) { var titem = new TargetItem(_id, this); titem.CurrentPort = port; this.TargetItems.Add(titem); Log.i("ADD Target Items2: ID:{0}, Port:{1}", _id, titem.CurrentPort.Caption); _id++; // jwoh add User/Factory mode [ if ((this.SelBoard == 1) && (this.DLEndpopup == false) && (this.IsIdle)) { if (this.FdebugOn) { titem.FileProgress = 100; } SendDebugtimer.Interval = 800; SendDebugtimer.Elapsed += new ElapsedEventHandler(timer_SendDebugon); SendDebugtimer.Start(); } // jwoh add User/Factory mode [ } } UpdateJobList(); } this.DownloadCommand.RaiseCanExecuteChanged(); InvokePropertyChanged("CanEfsBackup"); } else // removed { if (aChangedPort != null) { var item = this.TargetItems.FirstOrDefault(x => x.MatchPort(aChangedPort)); if (item != null && item.Id >= 0) // valid { this.TargetItems.Remove(item); // jwoh add User/Factory mode [ if ((this.SelBoard == 1) && (this.ChangedDebugPort.Count > 0)) { item.Print(LogLevels.Error, "===== DebugOff Port List Remove {0} =====", item.CurrentPort.Name); this.ChangedDebugPort.RemoveAll(ditem => ditem == item.CurrentPort.Name); if (this.ChangedDebugPort.Count == 0) { this.FdebugOn = false; } } // jwoh add User/Factory mode [ Log.i("REMOVE Target Items: ID:{0}, Port:{1}", item.Id, item.CurrentPort.Caption); _id--; // jwoh this.DownloadCommand.RaiseCanExecuteChanged(); } } } } else // busy state { if (aChangedPort != null) { lock (TargetItem._so) { Log.i("{0} Port:{1}", aInserted ? "ADD1" : "REMOVE1", aChangedPort.Caption); } foreach (var ti in this.TargetItems) { ti.UpdatedTargetPort(aChangedPort, aInserted); } } } }); }
protected abstract IEnumerable <ResultPack> EvaluateArticleResults(TargetItem evalTarget, ConfigBase evalConfig, ISourceValues evalValues, Period evalPeriod, IPeriodProfile evalProfile, IEnumerable <ResultPair> evalResults);
protected ResultMonad.Result <AbsenceEvaluateSource, string> BuildItem(TargetItem target, MonthAttendanceValue resultValue) { AbsenceEvaluateSource buildResult = new AbsenceEvaluateSource { AbsenceCode = target.Code(), DayPeriodFrom = resultValue.PeriodDayFrom, DayPeriodStop = resultValue.PeriodDayStop, ScheduleMonth = resultValue.HoursMonth, }; return(Result.Ok <AbsenceEvaluateSource, string>(buildResult)); }
/// <summary> /// Method to validate whether the request to add a primary target is valid or not /// </summary> /// <param name="target">primary target add request</param> public virtual void ValidateMetricAddTargetRequest(TargetItem target) { bool isDailyTargetsApplicable = target.TargetEntryMethodId == Constants.TargetEntryMethodDaily; //check whether metric is already exists for the kpi and scorecard targetMetricValidator.ValidateMetricForScorecardKPI(target); if (target.MetricType == MetricType.Primary) { // method to validate whether a primary metric already exists in the given time period targetMetricValidator.ValidatePrimaryMetricCount(target); } else if (target.MetricType == MetricType.Secondary) { // Method to validate whether only maximum allowed number of secondary metrics exists // in the given time period targetMetricValidator.ValidateSecondaryMetricCount(target); } //If the target entry method is daily,then the actual entry method should also be daily. if (target.TargetEntryMethodId == Constants.TargetEntryMethodDaily) { if (target.TrackingMethodId != Constants.TrackingMethodDaily) { throw new NDMSBusinessException(Constants.TargettEntryMethodMethodValidationErrorMessage); } } if (target.CascadeFromParent) { targetMetricValidator.ValidateCascadedMetric(target); } else { var currentDate = TimeZoneUtility.GetCurrentTimestamp().Date; var currentMonthStartDate = new DateTime(currentDate.Year, currentDate.Month, 1); //check whether effective start date is not a past month date if (target.EffectiveStartDate < currentMonthStartDate) { throw new NDMSBusinessException(Constants.TargetStartDatePastErrorMessage); } //check whether effective end date is not a future date if (target.EffectiveEndDate < currentDate) { throw new NDMSBusinessException(Constants.TargetEndDatePastErrorMessage); } // validate effective start date and end date entered ValidateTargetDates(target.EffectiveStartDate, target.EffectiveEndDate, target.CalendarYearId.Value); } //Check whether monthly targets entered falls //between the selected start date and end date ValidateTargetMonths(target.EffectiveStartDate, target.EffectiveEndDate, target.MonthlyTargets); //check whether Daily Targets entered are valid ValidateDailyTargets(target.MonthlyTargets, target.EffectiveStartDate, target.EffectiveEndDate); //check whether Stretch Goal Targets must be on par or beat the monthly target //based on the Goal type of the Metric if (target.IsStretchGoalEnabled == true) { ValidateStrechGoalTarget(target.MetricId.Value, target.MonthlyTargets); } //set stretch goal value in monthlyTargets list to null if stretch goal is disabled else { target.MonthlyTargets.ForEach(x => x.StretchGoalValue = null); } }
public GrilleFilterTargetItemPanel(TargetItem item) : this() { Display(item); }
private static Result <TaxableIncomeSum, string> GetSumTaxableIncome(TaxableIncomeSum agr, TargetItem resultTarget, IncomeTaxGeneralValue resultValue) { return(Result.Ok <TaxableIncomeSum, string>(agr.Aggregate(resultValue.IncomeGeneral, resultValue.IncomeExclude, resultValue.IncomeLolevel, resultValue.IncomeTaskAgr, resultValue.IncomePartner))); }