示例#1
0
 public AwardedMedal(int bitsMatchId, string player, MedalType medalType, int value)
 {
     BitsMatchId = bitsMatchId;
     Value = value;
     MedalType = medalType;
     Player = player;
 }
示例#2
0
 public AutoApprovalArguments(
     int customerID,
     long?cashRequestID,
     long?nlCashRequestID,
     decimal systemCalculatedAmount,
     Medal medal,
     MedalType medalType,
     TurnoverType?turnoverType,
     AutoDecisionFlowTypes flowType,
     bool errorInLGData,
     string tag,
     DateTime now,
     AConnection db,
     ASafeLog log
     )
 {
     CustomerID             = customerID;
     CashRequestID          = cashRequestID;
     NLCashRequestID        = nlCashRequestID;
     SystemCalculatedAmount = systemCalculatedAmount;
     Medal         = medal;
     MedalType     = medalType;
     TurnoverType  = turnoverType;
     FlowType      = flowType;
     ErrorInLGData = errorInLGData;
     Tag           = tag;
     Now           = now;
     DB            = db;
     Log           = log.Safe();
     TrailUniqueID = Guid.NewGuid();
 }         // constructor
示例#3
0
        }         // UseHmrc

        public void CheckForMatch(MedalOutputModel other)
        {
            // Other is null, i.e. it was not calculated, so it is a match.
            if (other == null)
            {
                this.wasMismatch = false;
                return;
            }             // if

            if (!string.IsNullOrWhiteSpace(other.Error))
            {
                AddError("Error in verification calculation: " + other.Error);
                return;
            }             // if

            // At this point both are not null and no error reported.

            // if NoMedal in both, no need to compare any other field.
            if ((MedalType == MedalType.NoMedal) && (other.MedalType == AutomationCalculator.Common.MedalType.NoMedal))
            {
                this.wasMismatch = false;
                return;
            }             // if

            this.wasMismatch =
                MedalType.ToString() != other.MedalType.ToString() ||
                Math.Abs(ValueAdded - other.ValueAdded) > 0.001M ||
                Math.Abs(TotalScore - other.Score * 100) > 0.001M ||
                Math.Abs(TotalScoreNormalized - other.NormalizedScore) > 0.001M ||
                MedalClassification.ToString() != other.Medal.ToString() ||
                Math.Abs(OfferedLoanAmount - other.OfferedLoanAmount) > 100; // TODO understand the difference in yodlee calculation and change the allowed diff to 0.01M
        }                                                                    // CheckForMatch
示例#4
0
 public static bool IsOnline(this MedalType variable)
 {
     return(variable.In(
                MedalType.OnlineLimited,
                MedalType.OnlineNonLimitedNoBusinessScore,
                MedalType.OnlineNonLimitedWithBusinessScore
                ));
 }         // class MedalTypeExtension
示例#5
0
        public bool AddMedalToSportsman(Sportsman sportsman, MedalType medalType)
        {
            var newMedal = new MedalSportsman(sportsman, medalType);

            if (Medals.Contains(newMedal))
            {
                return(false);
            }
            Medals.Add(newMedal);
            return(true);
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MissionPassedScreen"/> class.
 /// </summary>
 /// <param name="title">The title, the big yellow text.</param>
 /// <param name="subtitle">The subtitle, the text below the <see cref="Title"/>.</param>
 /// <param name="completionPercentage">The value that will be displayed as the completion percentage.</param>
 /// <param name="medal">The medal type displayed next to the completion percentage.</param>
 public MissionPassedScreen(string title, string subtitle, int completionPercentage, MedalType medal)
 {
     Title                = title;
     Subtitle             = subtitle;
     CompletionPercentage = completionPercentage;
     Medal                = medal;
     Items                = new MissionPassedScreenItemsCollection();
     InstructionalButtons = new InstructionalButtons();
     continueControlInstructionalButton = new InstructionalButton(ContinueControl, "Continue");
     InstructionalButtons.Buttons.Add(continueControlInstructionalButton);
 }
示例#7
0
        async Task <Object> WriteTopScore(string name, string level, string score, MedalType medal)
        {
            bool isSuccessful = false;

            try
            {
                StorageFile   file   = null;
                StorageFolder folder = ApplicationData.Current.LocalFolder;

                folder = await folder.CreateFolderAsync("Meta", CreationCollisionOption.OpenIfExists);

                file = await folder.CreateFileAsync("highscores.xml", CreationCollisionOption.OpenIfExists);

                IRandomAccessStream readStream = await file.OpenAsync(FileAccessMode.Read);

                Stream inStream = Task.Run(() => readStream.AsStreamForRead()).Result;

                XDocument document = null;

                try
                {
                    string data;

                    using (StreamReader reader = new StreamReader(inStream))
                    {
                        data = reader.ReadToEnd();
                    }

                    document = XDocument.Parse(data);
                }
                catch
                {
                    document = new XDocument();
                    document.Add(new XElement("scores"));
                }

                XElement element = new XElement("score", new XAttribute("name", name),
                                                new XAttribute("level", level), new XAttribute("score", score), new XAttribute("medal", (int)medal));

                document.Root.Add(element);

                file = await folder.CreateFileAsync("highscores.xml", Windows.Storage.CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteTextAsync(file, document.ToString());

                isSuccessful = true;
            }
            catch
            {
                isSuccessful = false;
            }

            return(isSuccessful);
        }
示例#8
0
        }         // class MedalTypeExtension

        public static bool In(this MedalType variable, params MedalType[] args)
        {
            foreach (MedalType mt in args)
            {
                if (variable == mt)
                {
                    return(true);
                }
            }

            return(false);
        } // class MedalTypeExtension
示例#9
0
 public AwardedMedal(
     int bitsMatchId,
     string rosterId,
     string player,
     MedalType medalType,
     int value)
 {
     BitsMatchId = bitsMatchId;
     RosterId    = rosterId;
     Value       = value;
     MedalType   = medalType;
     Player      = player;
 }
示例#10
0
    public void SetMedalType(MedalType medalType)
    {
        var material = MedalMaterials[(int)medalType];

        if (material != null)
        {
            gameObject.SetActive(true);
            transform.Find("MedalType").GetComponent <Text>().text     = medalType.ToString().ToUpper();
            transform.Find("Medal").GetComponent <Renderer>().material = material;
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
示例#11
0
 public Arguments(
     int nCustomerID,
     long?cashRequestID,
     long?nlCashRequestID,
     decimal nSystemCalculatedAmount,
     Medal nMedal,
     MedalType medalType,
     TurnoverType?turnoverType
     )
 {
     CustomerID             = nCustomerID;
     CashRequestID          = cashRequestID;
     NlCashRequestID        = nlCashRequestID;
     SystemCalculatedAmount = nSystemCalculatedAmount;
     Medal        = nMedal;
     MedalType    = medalType;
     TurnoverType = turnoverType;
 } // constructor
示例#12
0
    public static string MedalTypeToString(MedalType type)
    {
        switch (type)
        {
        case MedalType.Author:
            return("Author");

        case MedalType.Gold:
            return("Gold");

        case MedalType.Silver:
            return("Silver");

        case MedalType.Bronze:
            return("Bronze");
        }
        return(null);
    }
示例#13
0
        }         // Serialize

        public void SetArgs(
            int nCustomerID,
            long?cashRequestID,
            long?nlCashRequestID,
            decimal nAmount,
            Medal nMedal,
            MedalType medalType,
            TurnoverType?turnoverType
            )
        {
            this.m_oArguments = new Arguments(
                nCustomerID,
                cashRequestID,
                nlCashRequestID,
                nAmount,
                nMedal,
                medalType,
                turnoverType
                );
        }         // SetArgs
示例#14
0
        public static bool IsMedalUnlocked(MedalType medal)
        {
            if (AllProgressionUnlocked)
            {
                return(true);
            }

            SG.Lonestar.Inventory.BattleProgress progress = GetDuelApi().Progress;

            switch (medal)
            {
            // All Duelists on Hard (Not Archivist)
            case MedalType.AdvancedCombat:
                bool maul  = progress.HasCompleted(DuelAPI.Duelist.DarthMaul, 3);
                bool sis   = progress.HasCompleted(DuelAPI.Duelist.SeventhSister, 3);
                bool inq   = progress.HasCompleted(DuelAPI.Duelist.GrandInquisitor, 3);
                bool vader = progress.HasCompleted(DuelAPI.Duelist.DarthVader, 3);
                bool ren   = progress.HasCompleted(DuelAPI.Duelist.KyloRen, 3);
                return(maul && sis && inq && vader && ren);

            // Defeat Archivist on Med.
            case MedalType.Combat:
                return(progress.HasCompleted(DuelAPI.Duelist.Archivist, 2));

            // Beat Holochess on the Core planet, 3rd pillar
            case MedalType.Insight:
                return(GetChessApi().RatingForStage(PlanetType.Core, 3) > 0);

            // Only 1 level for TD
            case MedalType.Leadership:
                return(GetTDAPI().IsBattleUnlocked(TDAPI.Battles.Final_1));

            // Beat the archivist on hard
            case MedalType.Mastery:
                return(progress.HasCompleted(DuelAPI.Duelist.Archivist, 3));
            }

            return(false);
        }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MissionPassedScreen"/> class with the <see cref="Title"/> set to "mission passed".
 /// </summary>
 /// <param name="subtitle">The subtitle, the text below the <see cref="Title"/>.</param>
 /// <param name="completionPercentage">The value that will be displayed as the completion percentage.</param>
 /// <param name="medal">The medal type displayed next to the completion percentage.</param>
 public MissionPassedScreen(string subtitle, int completionPercentage, MedalType medal) : this("mission passed", subtitle, completionPercentage, medal)
 {
 }
		public MedalDistribution this[MedalType medalType]
		{
			get
			{
				foreach (MedalDistribution medalinfo in this.MedalsInfo)
				{
					if (medalinfo.Type == medalType)
						return medalinfo;
				}
				return null;
			}
		}
		public MedalDistribution(MedalType type, string imageUriString)
		{
			this.Type = type;
			this.CountryMedals = new List<CountryMedal>();
			this.Image = new BitmapImage(new Uri(imageUriString, UriKind.RelativeOrAbsolute));
		}
示例#18
0
 public MedalSportsman(Sportsman sportsman, MedalType medalType)
 {
     Sportsman = sportsman;
     MedalType = medalType;
 }
示例#19
0
 public void ChangeMedalType(MedalType medalType)
 {
     MedalType = medalType;
 }
示例#20
0
 public void ChangeSportsmanMedal(Sportsman sportsman, MedalType medalType)
 {
     Medals.FirstOrDefault(m => m.Sportsman == sportsman).ChangeMedalType(medalType);
 }
 public AwardedMedalReadModel(string player, MedalType medalType, int value)
 {
     Player = player;
     MedalType = medalType;
     Value = value;
 }
示例#22
0
        }                                                                    // CheckForMatch

        public void SaveToDb(long?cashRequestID, long?nlCashRequestID, string tag, AConnection db)
        {
            db.ExecuteNonQuery("StoreMedal", CommandSpecies.StoredProcedure,
                               new QueryParameter("CustomerId", CustomerId),
                               new QueryParameter("CalculationTime", CalculationTime),
                               new QueryParameter("MedalType", MedalType.ToString()),
                               new QueryParameter("FirstRepaymentDatePassed", FirstRepaymentDatePassed),
                               new QueryParameter("BusinessScore", BusinessScore),
                               new QueryParameter("BusinessScoreWeight", BusinessScoreWeight),
                               new QueryParameter("BusinessScoreGrade", BusinessScoreGrade),
                               new QueryParameter("BusinessScoreScore", BusinessScoreScore),
                               new QueryParameter("FreeCashFlowValue", FreeCashFlowValue),
                               new QueryParameter("FreeCashFlow", FreeCashFlow),
                               new QueryParameter("FreeCashFlowWeight", FreeCashFlowWeight),
                               new QueryParameter("FreeCashFlowGrade", FreeCashFlowGrade),
                               new QueryParameter("FreeCashFlowScore", FreeCashFlowScore),
                               new QueryParameter("HmrcAnnualTurnover", HmrcAnnualTurnover),
                               new QueryParameter("BankAnnualTurnover", BankAnnualTurnover),
                               new QueryParameter("OnlineAnnualTurnover", OnlineAnnualTurnover),
                               new QueryParameter("AnnualTurnover", AnnualTurnover),
                               new QueryParameter("AnnualTurnoverWeight", AnnualTurnoverWeight),
                               new QueryParameter("AnnualTurnoverGrade", AnnualTurnoverGrade),
                               new QueryParameter("AnnualTurnoverScore", AnnualTurnoverScore),
                               new QueryParameter("TangibleEquityValue", TangibleEquityValue),
                               new QueryParameter("TangibleEquity", TangibleEquity),
                               new QueryParameter("TangibleEquityWeight", TangibleEquityWeight),
                               new QueryParameter("TangibleEquityGrade", TangibleEquityGrade),
                               new QueryParameter("TangibleEquityScore", TangibleEquityScore),
                               new QueryParameter(
                                   "BusinessSeniority",
                                   BusinessSeniority.HasValue && BusinessSeniority.Value.Year > 1800 ? BusinessSeniority : null
                                   ),
                               new QueryParameter("BusinessSeniorityWeight", BusinessSeniorityWeight),
                               new QueryParameter("BusinessSeniorityGrade", BusinessSeniorityGrade),
                               new QueryParameter("BusinessSeniorityScore", BusinessSeniorityScore),
                               new QueryParameter("ConsumerScore", ConsumerScore),
                               new QueryParameter("ConsumerScoreWeight", ConsumerScoreWeight),
                               new QueryParameter("ConsumerScoreGrade", ConsumerScoreGrade),
                               new QueryParameter("ConsumerScoreScore", ConsumerScoreScore),
                               new QueryParameter("NetWorth", NetWorth),
                               new QueryParameter("NetWorthWeight", NetWorthWeight),
                               new QueryParameter("NetWorthGrade", NetWorthGrade),
                               new QueryParameter("NetWorthScore", NetWorthScore),
                               new QueryParameter("MaritalStatus", MaritalStatus.ToString()),
                               new QueryParameter("MaritalStatusWeight", MaritalStatusWeight),
                               new QueryParameter("MaritalStatusGrade", MaritalStatusGrade),
                               new QueryParameter("MaritalStatusScore", MaritalStatusScore),
                               new QueryParameter("NumberOfStores", NumberOfStores),
                               new QueryParameter("NumberOfStoresWeight", NumberOfStoresWeight),
                               new QueryParameter("NumberOfStoresGrade", NumberOfStoresGrade),
                               new QueryParameter("NumberOfStoresScore", NumberOfStoresScore),
                               new QueryParameter("PositiveFeedbacks", PositiveFeedbacks),
                               new QueryParameter("PositiveFeedbacksWeight", PositiveFeedbacksWeight),
                               new QueryParameter("PositiveFeedbacksGrade", PositiveFeedbacksGrade),
                               new QueryParameter("PositiveFeedbacksScore", PositiveFeedbacksScore),
                               new QueryParameter("EzbobSeniority", EzbobSeniority),
                               new QueryParameter("EzbobSeniorityWeight", EzbobSeniorityWeight),
                               new QueryParameter("EzbobSeniorityGrade", EzbobSeniorityGrade),
                               new QueryParameter("EzbobSeniorityScore", EzbobSeniorityScore),
                               new QueryParameter("NumOfLoans", NumOfLoans),
                               new QueryParameter("NumOfLoansWeight", NumOfLoansWeight),
                               new QueryParameter("NumOfLoansGrade", NumOfLoansGrade),
                               new QueryParameter("NumOfLoansScore", NumOfLoansScore),
                               new QueryParameter("NumOfLateRepayments", NumOfLateRepayments),
                               new QueryParameter("NumOfLateRepaymentsWeight", NumOfLateRepaymentsWeight),
                               new QueryParameter("NumOfLateRepaymentsGrade", NumOfLateRepaymentsGrade),
                               new QueryParameter("NumOfLateRepaymentsScore", NumOfLateRepaymentsScore),
                               new QueryParameter("NumOfEarlyRepayments", NumOfEarlyRepayments),
                               new QueryParameter("NumOfEarlyRepaymentsWeight", NumOfEarlyRepaymentsWeight),
                               new QueryParameter("NumOfEarlyRepaymentsGrade", NumOfEarlyRepaymentsGrade),
                               new QueryParameter("NumOfEarlyRepaymentsScore", NumOfEarlyRepaymentsScore),
                               new QueryParameter("ValueAdded", ValueAdded),
                               new QueryParameter("InnerFlowName", TurnoverType == null ? null : TurnoverType.ToString()),
                               new QueryParameter("TotalScore", TotalScore),
                               new QueryParameter("TotalScoreNormalized", TotalScoreNormalized),
                               new QueryParameter("Medal", MedalClassification.ToString()),
                               new QueryParameter("Error", Error),
                               new QueryParameter("OfferedLoanAmount", OfferedLoanAmount),
                               new QueryParameter("NumOfHmrcMps", NumOfHmrcMps),
                               new QueryParameter("ZooplaValue", ZooplaValue),
                               new QueryParameter("EarliestHmrcLastUpdateDate", EarliestHmrcLastUpdateDate),
                               new QueryParameter("EarliestYodleeLastUpdateDate", EarliestYodleeLastUpdateDate),
                               new QueryParameter("AmazonPositiveFeedbacks", AmazonPositiveFeedbacks),
                               new QueryParameter("EbayPositiveFeedbacks", EbayPositiveFeedbacks),
                               new QueryParameter("NumberOfPaypalPositiveTransactions", NumberOfPaypalPositiveTransactions),
                               new QueryParameter("MortgageBalance", MortgageBalance),
                               new QueryParameter("CapOfferByCustomerScoresValue", CapOfferByCustomerScoresValue),
                               new QueryParameter(
                                   "CapOfferByCustomerScoresTable",
                                   CapOfferByCustomerScoresTable.SafeToFormattedString()
                                   ),
                               new QueryParameter("Tag", tag),
                               new QueryParameter("MaxOfferedLoanAmount", MaxOfferedLoanAmount),
                               new QueryParameter("CashRequestID", cashRequestID),
                               new QueryParameter("NLCashRequestID", nlCashRequestID)
                               );
        }         // SaveToDb
示例#23
0
        /// <summary>
        ///     Score is calculated by sum of all Weight*Grade for each parameter
        ///     The normalized score is calculated by (scoreSum - minScoreSum) / (maxScoreSum - minScoreSum)
        /// </summary>
        /// <param name="dict">Weight dictionary</param>
        /// <param name="inputModel">Medal input model</param>
        /// <param name="medalType">Medal type that is calculated</param>
        /// <returns>Medal output model</returns>
        protected MedalOutputModel CalcScoreMedalOffer(Dictionary <Parameter, Weight> dict, MedalInputModel inputModel, MedalType medalType = MedalType.NoMedal)
        {
            decimal minScoreSum = 0;
            decimal maxScoreSum = 0;
            decimal scoreSum    = 0;

            foreach (var weight in dict.Values)
            {
                weight.MinimumScore = weight.FinalWeight * weight.MinimumGrade;
                weight.MaximumScore = weight.FinalWeight * weight.MaximumGrade;
                weight.Score        = weight.Grade * weight.FinalWeight;
                minScoreSum        += weight.MinimumScore;
                maxScoreSum        += weight.MaximumScore;
                scoreSum           += weight.Score;
            }             // for

            decimal score       = (scoreSum - minScoreSum) / (maxScoreSum - minScoreSum);
            Medal   medal       = GetMedal(MedalRangesConstats.MedalRanges, score);
            var     medalOutput = new MedalOutputModel {
                TurnoverType                  = inputModel.TurnoverType,
                Medal                         = medal,
                MedalType                     = medalType,
                NormalizedScore               = score,
                Score                         = scoreSum,
                WeightsDict                   = dict,
                AnnualTurnover                = inputModel.AnnualTurnover,
                FreeCashflow                  = inputModel.FreeCashFlowValue,
                FirstRepaymentDatePassed      = inputModel.FirstRepaymentDatePassed,
                ValueAdded                    = inputModel.ValueAdded,
                CustomerId                    = inputModel.CustomerId,
                CalculationDate               = inputModel.CalculationDate,
                UseHmrc                       = inputModel.UseHmrc,
                CapOfferByCustomerScoresTable = inputModel.CapOfferByCustomerScoresTable.ToFormattedString(),
                CapOfferByCustomerScoresValue = inputModel.CapOfferByCustomerScoresValue,
                ConsumerScore                 = inputModel.ConsumerScore,
                BusinessScore                 = inputModel.BusinessScore,
            };

            return(medalOutput);
        }         // CalcScoreMedalOffer
示例#24
0
 public AwardedMedalReadModel(string player, MedalType medalType, int value)
 {
     Player    = player;
     MedalType = medalType;
     Value     = value;
 }
示例#25
0
 public IAsyncOperation <Object> WriteScoreAsync(string name, string level, string score, MedalType medal)
 {
     return((IAsyncOperation <Object>)AsyncInfo.Run((CancellationToken token) => WriteTopScore(name, level, score, medal)));
 }