Example #1
0
        private async Task <BonusPoints> GetData(SqlDataReader reader)
        {
            BonusPoints p = new BonusPoints();

            try
            {
                while (await reader.ReadAsync())
                {
                    BonusPoints points = new BonusPoints()
                    {
                        Id          = (Guid)reader["Id"],
                        Points      = (int)reader["Points"],
                        DateAquired = Convert.ToDateTime(reader["DateAquired"])
                    };
                    p = points;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
            }
            return(p);
        }
Example #2
0
        private async Task <List <BonusPoints> > GetAllData(SqlDataReader reader)
        {
            List <BonusPoints> lst = new List <BonusPoints>();

            try
            {
                while (await reader.ReadAsync())
                {
                    BonusPoints points = new BonusPoints()
                    {
                        Id          = (Guid)reader["Id"],
                        Points      = (int)reader["Points"],
                        DateAquired = Convert.ToDateTime(reader["DateAquired"])
                    };
                    lst.Add(points);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
            }
            return(lst);
        }
Example #3
0
        public async Task <IActionResult> AddBonusPoints(BonusPointsModel bonusPointsModel)
        {
            var targetEvent = await GetEventById(bonusPointsModel.BEventId);

            if (ModelState.IsValid && targetEvent != null)
            {
                var entity = new BonusPoints
                {
                    EventID    = bonusPointsModel.BEventId,
                    OptionID   = bonusPointsModel.BOptionId,
                    QuestionID = bonusPointsModel.BQuestionId,
                    Points     = bonusPointsModel.BPoints,
                    Reason     = bonusPointsModel.BReason,
                };

                _context.BonusPoints.Add(entity);
                _context.SaveChanges();

                return(RedirectToAction("Details", "Event", new
                {
                    eventId = bonusPointsModel.BEventId,
                }));
            }

            return(View("Details", await InitEventDetailModel(bonusPointsModel.BEventId)));
        }
        public async Task Reserve([FromQuery] Guid userID, [FromQuery] Guid ticketID, [FromQuery] Guid destinationID, [FromQuery] Guid departureID)
        {
            UsersTickets uTicket = new UsersTickets()
            {
                ID            = Guid.NewGuid(),
                UserID        = userID,
                TicketID      = ticketID,
                DestinationID = destinationID,
                DepartureID   = departureID
            };

            await _dataService.ReserveTicket(uTicket);

            BonusPoints points = new BonusPoints()
            {
                Id          = Guid.NewGuid(),
                Points      = 5,
                DateAquired = DateTime.Now
            };

            await _dataService.AddPoints(points);


            UserBonusPoints userBonus = new UserBonusPoints()
            {
                Id      = Guid.NewGuid(),
                UserID  = userID,
                PointID = points.Id
            };

            await _dataService.AddUserBonusPoints(userBonus);
        }
Example #5
0
        public void Update(int dt)
        {
            if (GameOver)
            {
                return;
            }

            BonusPoints.Update(dt);

            Timer.Update(dt);

            if (Timer.State == DynamicState.END)
            {
                GameOver = true;
                return;
            }

            bool isBusy       = false;
            bool hasInvisible = false;

            foreach (var go in GameMatrix)
            {
                go.Update(dt);
                isBusy       |= go.IsBusy();
                hasInvisible |= !go.Visible;
            }

            if (!isBusy)
            {
                if (hasInvisible)
                {
                    GameMatrix.Next(MatrixState.KILL);
                }
                else
                {
                    GameMatrix.Next();

                    if (clientSwapModel != null && GameMatrix.State == MatrixState.NONE)
                    {
                        switch (clientSwapModel.Direction)
                        {
                        case SwapDirection.HORIZONTAL:
                            GameMatrix.SwapH(clientSwapModel.GameObject1, clientSwapModel.GameObject2);
                            break;

                        case SwapDirection.VERTICAL:
                            GameMatrix.SwapV(clientSwapModel.GameObject1, clientSwapModel.GameObject2);
                            break;
                        }
                    }

                    if (clientSwapModel != null)
                    {
                        clientSwapModel = null;
                    }
                }
            }

            CanClientInput = !isBusy && GameMatrix.State == MatrixState.NONE;
        }
Example #6
0
    void Start()
    {
        time = 0f;

        pacMan = GameObject.Find ("PacMan");
        gb = GameObject.Find ("GameBrain").GetComponent<GameBrain>();
        bP = GameObject.Find ("FruitPlaces").GetComponent<BonusPoints>();

        bP.IsBonusItem();
    }
Example #7
0
        protected override Constants.ProcessOutcome Process()
        {
            var fileName = String.Format(Settings.Default.FileName, DateTime.Now.AddDays(Settings.Default.FileNameDateCheckOffsetDays).ToString("yyyyMMdd"));

            importer = new BonusPoints(Settings.Default.FilePath, fileName, Settings.Default.StagingTableName,
                                       Settings.Default.FormatFilePath, Settings.Default.ArchivePath, Settings.Default.SummaryReportErrorToEmailAddress, Settings.Default.SummaryReportFromEmailAddress, Settings.Default.SummaryReportFromAddressFriendlyName,
                                       Settings.Default.SqlaServerPath,
                                       Settings.Default.SqlbServerPath,
                                       Settings.Default.LocalSqlPath,
                                       Settings.Default.TemporaryUploadFolder,
                                       Settings.Default.DaysToRun);

            return(importer.Process());
        }
Example #8
0
        private static int GetValue_toSpend(BonusPoints Type, int Value)
        {
            if (Value > 0)
            {
                return(Value);
            }

            if (Value == 0)
            {
                return(0);
            }

            switch (Type)
            {
            case BonusPoints.core0:
            case BonusPoints.core1:
                return(Get_UnspentPoints_Core());

            case BonusPoints.core2:
                return(GetPointsNeeded_ToMaxMovement());

            case BonusPoints.core3:
                return(Get_UnspentPoints_Core());

            case BonusPoints.offense0:
            case BonusPoints.offense1:
            case BonusPoints.offense2:
            case BonusPoints.offense3:
                return(Get_UnspentPoints_Offense());

            case BonusPoints.defense0:
            case BonusPoints.defense1:
            case BonusPoints.defense2:
            case BonusPoints.defense3:
                return(Get_UnspentPoints_Defense());

            case BonusPoints.utility0:
            case BonusPoints.utility1:
            case BonusPoints.utility2:
            case BonusPoints.utility3:
                return(Get_UnspentPoints_Utility());


            default:
                return(0);
            }
        }
            public static void Load()
            {
                if (File.Exists(A_Collection.Me.ParagonPointSpender.ParagonPoints_FilePath))
                {
                    Dictionary <long, List <ParagonPointSetup> > Buffer = new Dictionary <long, List <ParagonPointSetup> >();

                    var Lines = File.ReadAllLines(A_Collection.Me.ParagonPointSpender.ParagonPoints_FilePath);

                    foreach (var line in Lines)
                    {
                        var split = line.Split('\t');

                        long   heroid = long.Parse(split[0]);
                        int    id     = int.Parse(split[1]);
                        string name   = split[2];

                        var bonuspoints = split[3];

                        var b_split = bonuspoints.Split(':');

                        foreach (var bonuspoint in b_split)
                        {
                            var _split = bonuspoint.Split('|');

                            BonusPoints Type     = (BonusPoints)Enum.Parse(typeof(BonusPoints), _split[0]);
                            int         Value    = int.Parse(_split[1]);
                            int         MaxValue = int.Parse(_split[2]);

                            if (!Buffer.ContainsKey(heroid))
                            {
                                Buffer.Add(heroid, new List <ParagonPointSetup>());
                            }

                            if (Buffer[heroid].FirstOrDefault(x => x.ID == id) == null)
                            {
                                Buffer[heroid].Add(new ParagonPointSetup(id, name, new List <BonusPoint>()));
                            }

                            Buffer[heroid].FirstOrDefault(x => x.ID == id).BonusPoints.Add(new BonusPoint(Type, Value, MaxValue));
                        }
                    }

                    A_Collection.Me.ParagonPointSpender.Setups = Buffer;
                }
            }
Example #10
0
        private void Awake()
        {
            ObjectPool.PreLoad(GameResources.GameObjects["Piece"], 50);
            ObjectPool.PreLoad(GameResources.GameObjects["PieceLayer"], 50);
            ObjectPool.PreLoad(GameResources.GameObjects["LightningBolt"], 10);
            ObjectPool.PreLoad(GameResources.GameObjects["Animated Text"], 5);

            ObjectPool.PreLoad(GameResources.ParticleEffects["Landing"], 50);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Piece Destroy"], 50);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Star Shot"], 5);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Score Shot 1"], 2);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Score Shot 2"], 2);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Score Shot 3"], 2);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Piece Change"], 10);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Powerup Unlocked"], 2);
            ObjectPool.PreLoad(GameResources.ParticleEffects["Explosion"], 2);

            BonusPoints.Setup();
        }
Example #11
0
        private void Save_Setups()
        {
            try
            {
                List <ParagonPointSetup> Buffer = new List <ParagonPointSetup>();

                foreach (var tabpage in TabControl_ParagonPoints.TabPages.OfType <TabPage>())
                {
                    DataGridView DG = tabpage.Controls.OfType <DataGridView>().FirstOrDefault();

                    List <BonusPoint> BonusPoints = new List <BonusPoint>();

                    foreach (var row in DG.Rows.OfType <DataGridViewRow>())
                    {
                        if (row.Cells["Property"].Value != null)
                        {
                            BonusPoints Type =
                                (BonusPoints)Enum.Parse(typeof(BonusPoints), row.Cells["Property"].Value as string);

                            int Value = int.Parse(row.Cells["Value"].Value as string);

                            BonusPoints.Add(new BonusPoint(Type, Value, Load_MaxValue(Type.ToString())));
                        }
                    }

                    Buffer.Add(new ParagonPointSetup(tabpage.TabIndex, tabpage.Name, BonusPoints));
                }

                if (!A_Collection.Me.ParagonPointSpender.Setups.ContainsKey(A_Collection.Me.HeroGlobals.HeroID))
                {
                    A_Collection.Me.ParagonPointSpender.Setups.Add(A_Collection.Me.HeroGlobals.HeroID, Buffer);
                }
                else
                {
                    A_Collection.Me.ParagonPointSpender.Setups[A_Collection.Me.HeroGlobals.HeroID] = Buffer;
                }

                A_Tools.T_ExternalFile.ParagonPointSpenderSettings.Save();
            }
            catch (Exception)
            {
            }
        }
Example #12
0
        private static int OpenTab_byType(BonusPoints Type)
        {
            try
            {
                switch (Type)
                {
                case BonusPoints.core0:
                case BonusPoints.core1:
                case BonusPoints.core2:
                case BonusPoints.core3:
                    OpenCore_Tab();
                    return(0);

                case BonusPoints.offense0:
                case BonusPoints.offense1:
                case BonusPoints.offense2:
                case BonusPoints.offense3:
                    OpenOffense_Tab();
                    return(1);

                case BonusPoints.defense0:
                case BonusPoints.defense1:
                case BonusPoints.defense2:
                case BonusPoints.defense3:
                    OpenDefense_Tab();
                    return(2);

                case BonusPoints.utility0:
                case BonusPoints.utility1:
                case BonusPoints.utility2:
                case BonusPoints.utility3:
                    OpenUtility_Tab();
                    return(3);
                }
                return(0);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Example #13
0
        public async Task <BonusPoints> AddPoints(BonusPoints points)
        {
            BonusPoints pts = new BonusPoints();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                string sql = "Insert into BonusPoints(Id, Points, DateAquired)";
                sql += " Values(@Id, @Points,@DateAquired)";

                SqlCommand cmd = new SqlCommand(sql, con);


                cmd.Parameters.AddWithValue("@Id", points.Id);
                cmd.Parameters.AddWithValue("@Points", points.Points);
                cmd.Parameters.AddWithValue("@DateAquired", points.DateAquired);

                con.Open();
                await cmd.ExecuteNonQueryAsync();

                con.Close();
                return(pts);
            }
        }
Example #14
0
    void Start()
    {
        int throttleTime = 150;

        var scoreGameObject = GameObject.Find("Score");

        ScoreText = scoreGameObject.GetComponent <TextMeshProUGUI>();
        BonusUI   = BonusPoints.GetComponent <BonusPoints>();

        Physics2D.IgnoreLayerCollision(8, 8, true);
        var x      = EnemyLaunch.GetComponent <MeshCollider>();
        var bounds = x.bounds;
        Func <TimeSpan, bool> lowerLimt =
            _ => MousePosition.ToWorldSpace().Position.y > ToLow;
        var left = LeftMissileBase.GetComponent <MissileBase>();

        OnKey(left.Key).Throttle(throttleTime).Where(lowerLimt).Sink(left.Launch);
        var center = CenterMissileBase.GetComponent <MissileBase>();

        OnKey(center.Key).Throttle(throttleTime).Where(lowerLimt).Sink(center.Launch);
        var right = RightMissileBase.GetComponent <MissileBase>();

        OnKey(right.Key).Throttle(throttleTime).Where(lowerLimt).Sink(right.Launch);
    }
Example #15
0
        private static int SpendPoints_byType(BonusPoints Type, int Value)
        {
            try
            {
                int spentpoints = 0;

                switch (Type)
                {
                case BonusPoints.core0:
                    spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 0);
                    break;

                case BonusPoints.core1:
                    spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 0);
                    break;

                case BonusPoints.core2:
                    spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 0);
                    break;

                case BonusPoints.core3:
                    spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 0);
                    break;

                case BonusPoints.offense0:
                    spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 1);
                    break;

                case BonusPoints.offense1:
                    spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 1);
                    break;

                case BonusPoints.offense2:
                    spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 1);
                    break;

                case BonusPoints.offense3:
                    spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 1);
                    break;

                case BonusPoints.defense0:
                    spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 2);
                    break;

                case BonusPoints.defense1:
                    spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 2);
                    break;

                case BonusPoints.defense2:
                    spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 2);
                    break;

                case BonusPoints.defense3:
                    spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 2);
                    break;

                case BonusPoints.utility0:
                    spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 3);
                    break;

                case BonusPoints.utility1:
                    spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 3);
                    break;

                case BonusPoints.utility2:
                    spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 3);
                    break;

                case BonusPoints.utility3:
                    spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 3);
                    break;
                }

                return(spentpoints);
            }
            catch (Exception)
            {
                return(0);
            }
        }
        private static int GetValue_toSpend(BonusPoints Type, int Value)
        {
            if(Value > 0)
                return Value;

            if (Value == 0)
                return 0;

            switch (Type)
            {
                case BonusPoints.core0:
                case BonusPoints.core1:
                    return Get_UnspentPoints_Core();

                case BonusPoints.core2:
                    return GetPointsNeeded_ToMaxMovement();

                case BonusPoints.core3:
                    return Get_UnspentPoints_Core();

                case BonusPoints.offense0:
                case BonusPoints.offense1:
                case BonusPoints.offense2:
                case BonusPoints.offense3:
                    return Get_UnspentPoints_Offense();

                case BonusPoints.defense0:
                case BonusPoints.defense1:
                case BonusPoints.defense2:
                case BonusPoints.defense3:
                    return Get_UnspentPoints_Defense();

                case BonusPoints.utility0:
                case BonusPoints.utility1:
                case BonusPoints.utility2:
                case BonusPoints.utility3:
                    return Get_UnspentPoints_Utility();


                default:
                    return 0;
            }
        }
        private static int SpendPoints_byType(BonusPoints Type, int Value)
        {
            try
            {
                int spentpoints = 0;

                switch (Type)
                {
                        case BonusPoints.core0:
                        spentpoints += Spent_Points(0, GetValue_toSpend(Type,Value), 0);
                        break;

                    case BonusPoints.core1:
                        spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 0);
                        break;

                    case BonusPoints.core2:
                        spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 0);
                        break;

                    case BonusPoints.core3:
                        spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 0);
                        break;

                    case BonusPoints.offense0:
                        spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 1);
                        break;

                    case BonusPoints.offense1:
                        spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 1);
                        break;

                    case BonusPoints.offense2:
                        spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 1);
                        break;

                    case BonusPoints.offense3:
                        spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 1);
                        break;

                    case BonusPoints.defense0:
                        spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 2);
                        break;

                    case BonusPoints.defense1:
                        spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 2);
                        break;

                    case BonusPoints.defense2:
                        spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 2);
                        break;

                    case BonusPoints.defense3:
                        spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 2);
                        break;

                    case BonusPoints.utility0:
                        spentpoints += Spent_Points(0, GetValue_toSpend(Type, Value), 3);
                        break;

                    case BonusPoints.utility1:
                        spentpoints += Spent_Points(1, GetValue_toSpend(Type, Value), 3);
                        break;

                    case BonusPoints.utility2:
                        spentpoints += Spent_Points(2, GetValue_toSpend(Type, Value), 3);
                        break;

                    case BonusPoints.utility3:
                        spentpoints += Spent_Points(3, GetValue_toSpend(Type, Value), 3);
                        break;
                }

                return spentpoints;
            }
            catch (Exception)
            {
                return 0;
            }
        }
        private static int OpenTab_byType(BonusPoints Type)
        {
            try
            {
                switch (Type)
                {
                        case BonusPoints.core0:
                        case BonusPoints.core1:
                        case BonusPoints.core2:
                        case BonusPoints.core3:
                        OpenCore_Tab();
                        return 0;

                        case BonusPoints.offense0:
                        case BonusPoints.offense1:
                        case BonusPoints.offense2:
                        case BonusPoints.offense3:
                        OpenOffense_Tab();
                        return 1;

                        case BonusPoints.defense0:
                        case BonusPoints.defense1:
                        case BonusPoints.defense2:
                        case BonusPoints.defense3:
                        OpenDefense_Tab();
                        return 2;

                        case BonusPoints.utility0:
                        case BonusPoints.utility1:
                        case BonusPoints.utility2:
                        case BonusPoints.utility3:
                        OpenUtility_Tab();
                        return 3;

                }
                return 0;
            }
            catch (Exception)
            {
                return 0;
            }
        }
Example #19
0
 /// <summary>
 /// Gets a hash code for the current book
 /// </summary>
 /// <returns>A hash code for the current book</returns>
 public override int GetHashCode()
 {
     return(Id.GetHashCode() + FirstName.GetHashCode() + LastName.GetHashCode() +
            Balance.GetHashCode() + BonusPoints.GetHashCode() + AccountType.GetHashCode() +
            BonusPointsCalculator.GetHashCode());
 }
 public Task <BonusPoints> AddPoints(BonusPoints points)
 {
     throw new NotImplementedException();
 }
 public async Task <BonusPoints> AddPoints(BonusPoints points)
 {
     return(await _bonusPRepository.AddPoints(points));
 }
 public BonusPoint(BonusPoints type, int value, int maxvalue)
 {
     this.Type     = type;
     this.Value    = value;
     this.MaxValue = maxvalue;
 }
Example #23
0
 public override void BonusSetter()
 {
     bonus = new BonusPoints();
 }