public async Task <RO <string> > CustomerChangePoints([FromBody] ClientChangePointsData clientdata)
        {
            var ro = new RO <string>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CustomerChangePoints(clientdata);
                                #else
                var result = await VendorDL.CustomerChangePoints(clientdata);

                if (result != null)
                {
                    ro.ReturnCode  = 0;
                    ro.ReturnValue = result;
                }
                else
                {
                    ro.ReturnCode = 100;
                }
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CustomerChangePoints - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public async Task <RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList> > CustomerAccessPoints([FromBody] CurrentClientData currentClient)
        {
            var ro = new RO <BossIDWS.Vendor.REST.ReturnObjects.AccessPointList>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CustomerAccessPoints(currentClient);
                                #else
                var detailsList = await VendorDL.CustomerAccessPoints(currentClient.CustomerKey);

                var ro = new RO <AccessPointDetailList>
                {
                    ReturnCode  = 0,
                    ReturnValue = detailsList
                };
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CustomerAccessPoints - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public async Task <RO <object> > CustomerEvents([FromBody] CustomerEventsData events)
        {
            // if events.Client.Customerkey = "ALL" - return all clients - all events
            var ro = new RO <object>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CustomerEvents(events);
                                #else
                var eventsList = await VendorDL.GetCustomerEvents(events);

                var ro = new RO <CustomerEventList>
                {
                    ReturnCode  = 0,
                    ReturnValue = eventsList
                };
                return(ro);
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = "Bad request - CustomerEvents - Incorrect parameters:" + " - " + events.CustomerKey + "/" + events.FromDate + "/" + events.ToDate;
            }
            return(ro);
        }
        public async Task <RO <Client> > CustomerNewHousehold([FromBody] HouseHoldClientData client)
        {
            var ro = new RO <Client>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.AddNewClient(client);
                                #else
                var result = await VendorDL.AddNewClient(client);

                if (result != null)
                {
                    ro.ReturnCode  = 0;
                    ro.ReturnValue = result;
                }
                else
                {
                    ro.ReturnCode = -1;
                }
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = -100;
                ro.Message    = $"Bad request - CustomerNewHousehold - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public async Task <RO <string> > CustomerDelete([FromBody] CurrentClientData currentClient)
        {
            var ro = new RO <string>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CustomerDelete(currentClient);
                                #else
                var returnCode = await VendorDL.CustomerStatusChanged(true, true, currentClient.CustomerKey);

                var ro = new RO <string> {
                    ReturnCode = returnCode
                };
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CustomerDelete - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public async Task <RO <Client> > CustomerNewCommercial([FromBody] CommercialClientData commercialClient)
        {
            var ro = new RO <Client>(Constants.NotImplementedReturnCode, Constants.NotImplementedMessage,
                                     new Client());

            return(await Task.FromResult(ro));
        }
Exemple #7
0
        public static async Task <RO <string> > CardReplace(ReplacementCardData replacementCards)
        {
            var ro = new RO <string> {
                ReturnValue = string.Empty, ReturnCode = 0, Message = string.Empty
            };

            var cards   = _db.GetCollection <DBCard>("cards");
            var clients = _db.GetCollection <DBClient>("clients");

            var card = new DBCard {
                RFID = replacementCards.RFID
            };

            cards.Insert(card);

            var client = clients.FindById(int.Parse(replacementCards.CustomerKey));

            client.Cards.Add(card);
            clients.Update(client);

            card         = cards.FindOne(c => c.RFID.Equals(replacementCards.ReplacementRFID));
            card.Blocked = true;
            card.Deleted = true;
            cards.Update(card);

            card = client.Cards.Find(c => c.RFID == replacementCards.ReplacementRFID);
            client.Cards.Remove(card);
            clients.Update(client);

            return(await Task.FromResult(ro));
        }
Exemple #8
0
        public async Task <RO <AccessPointDetailList> > AccessPointDetails(AccessPointData accessPoint)
        {
            var ro = new RO <AccessPointDetailList>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.AccessPointDetails(accessPoint);
                                #else
                var accesspoints = await VendorDL.AccessPointDetails(accessPoint);

                ro.ReturnCode  = 0;
                ro.ReturnValue = accesspoints;
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - AccessPointDetails - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public void TestImmutablePrivateConstructorDictionaryImplementation()
        {
            var d = new Dictionary <object, object> {
                { "A", new C {
                      P = "x"
                  } }
            };
            var id = RO <object, object> .ConstructorReplacement(d);

            var sd  = CreateSortedDictionary(d);
            var sl  = CreateSortedList(d);
            var obj = new T {
                D = d, ID = id, SD = sd, SL = sl
            };
            var json     = obj.ToJson();
            var rep      = "{ 'A' : { '_t' : 'DictionaryGenericSerializers.C', 'P' : 'x' } }";
            var expected = "{ 'D' : #R, 'ID' : #R, 'SD' : #R, 'SL' : #R }".Replace("#R", rep).Replace("'", "\"");

            Assert.AreEqual(expected, json);

            var bson       = obj.ToBson();
            var rehydrated = BsonSerializer.Deserialize <T>(bson);

            Assert.IsInstanceOf <Dictionary <object, object> >(rehydrated.D);
            Assert.IsInstanceOf <Dictionary <object, object> >(rehydrated.ID);
            Assert.IsInstanceOf <SortedDictionary <object, object> >(rehydrated.SD);
            Assert.IsInstanceOf <SortedList <object, object> >(rehydrated.SL);
            Assert.IsTrue(bson.SequenceEqual(rehydrated.ToBson()));
        }
Exemple #10
0
        private static void UseItems(Obj_AI_Base unit, bool isMinion = false)
        {
            if (!unit.IsValidTarget())
            {
                return;
            }


            if (SKOMenu.Item("Hydra").GetValue <bool>() && player.Distance(unit) < HYD.Range)
            {
                HYD.Cast();
            }
            if (SKOMenu.Item("Hydra").GetValue <bool>() && player.Distance(unit) < TMT.Range)
            {
                TMT.Cast();
            }
            if (SKOMenu.Item("BOTRK").GetValue <bool>() && player.Distance(unit) <= BRK.Range)
            {
                if (isMinion)
                {
                    return;
                }
                BRK.Cast(unit);
            }
            if (SKOMenu.Item("BOTRK").GetValue <bool>() && player.Distance(unit) <= BWC.Range)
            {
                BWC.Cast(unit);
            }
            if (SKOMenu.Item("RO").GetValue <bool>() && player.Distance(unit) <= RO.Range)
            {
                if (isMinion)
                {
                    return;
                }
                RO.Cast();
            }
            if (SKOMenu.Item("DFG").GetValue <bool>() && player.Distance(unit) <= DFG.Range)
            {
                if (isMinion)
                {
                    return;
                }
                DFG.Cast(unit);
            }
            if (SKOMenu.Item("YMU").GetValue <bool>() && player.Distance(unit) <= YMG.Range)
            {
                YMG.Cast();
            }
            if (SKOMenu.Item("SOD").GetValue <bool>() && player.Distance(unit) <= STD.Range)
            {
                STD.Cast();
            }
        }
Exemple #11
0
 private static void UseItems(Obj_AI_Hero target)
 {
     if (player.Distance(target) < player.AttackRange + player.BoundingRadius)
     {
         TMT.Cast();
         HYD.Cast();
     }
     BWC.Cast(target);
     BRK.Cast(target);
     RO.Cast(target);
     YMG.Cast();
 }
Exemple #12
0
        private static void TripleQ(Obj_AI_Hero target)
        {
            if (target.IsValidTarget())
            {
                if (Player.Mana == 5 && R.IsReady() && Player.Distance(target) <= R.Range && Q.IsReady())
                {
                    R.Cast();
                }
                if (Player.Mana < 5)
                {
                    Drawing.DrawText(Player.Position.X, Player.Position.Y, Color.Red, "R is not ready, or you do not have 5 ferocity");
                }


                if (Player.Mana == 5 && Player.HasBuff("RengarR") && Q.IsReady() && Player.Distance(target) <= Q.Range)
                {
                    Q.Cast();
                }
                if (Player.Mana == 5 && !Player.HasBuff("RengarR") && Q.IsReady() && Player.Distance(target) <= Q.Range)
                {
                    Q.Cast();
                }
                if (Player.Mana <= 4)
                {
                    if (Q.IsReady() && Player.Distance(target) <= Q.Range)
                    {
                        Q.Cast();
                    }
                    if (W.IsReady() && Player.Distance(target) <= W.Range)
                    {
                        W.Cast();
                    }
                    if (E.IsReady() && Player.Distance(target) <= E.Range)
                    {
                        E.Cast(target, PacketCast);
                    }
                }
                if (Player.Distance(target) < Player.AttackRange + 50)
                {
                    TMT.Cast();
                    HYD.Cast();
                    STD.Cast();
                }
                BWC.Cast(target);
                BRK.Cast(target);
                RO.Cast(target);
                YMG.Cast();
            }
        }
Exemple #13
0
        public static async Task <RO <string> > AccessPointOutOfOrder(AccessPointOutOfOrderData accessPointData)
        {
            var accesspointsList = _db.GetCollection <DBAccessPoint>("accesspoints");
            var accessPoints     = accesspointsList.FindAll();

            if (accessPointData.InstallationID != "NA")
            {
                accessPoints = accessPoints.Where(a => a.installationid.Equals(accessPointData.InstallationID));
            }

            DBAccessPoint accessPoint = null;

            if (!string.IsNullOrWhiteSpace(accessPointData.AccessPoint))
            {
                switch (accessPointData.Type)
                {
                case AccessPointData.AccessPointType.ID:
                    accessPoint = accessPoints.SingleOrDefault(a => a.accesspointid.Equals(accessPointData.AccessPoint));
                    break;

                case AccessPointData.AccessPointType.TAG:
                    accessPoint = accessPoints.SingleOrDefault(a => a.tag.Equals(accessPointData.AccessPoint));
                    break;

                case AccessPointData.AccessPointType.NAME:
                    accessPoint = accessPoints.SingleOrDefault(a => a.name.Equals(accessPointData.AccessPoint));
                    break;
                }
            }

            var ro = new RO <string> {
                ReturnValue = string.Empty, ReturnCode = 0, Message = string.Empty
            };

            if (accessPoint != null)
            {
                accessPoint.state = "U";
                //accessPoint.Details.error = accessPointData.Message;
                accesspointsList.Update(accessPoint);
            }
            else
            {
                ro.ReturnCode = -1;
                ro.Message    = "Could not update status...";
            }

            return(await Task.FromResult(ro));
        }
Exemple #14
0
        public static RO <T> GetData <T>(string url, string json)
        {
            var ro = new RO <T>();

            switch (Type)
            {
            case TestType.REST:
                ro = Utils.RequestRestData <T>(ServiceUrl, url, json, "POST", APIKey);
                break;

            case TestType.BOSSID:
                var xml = Utils.SerializeObjectToXml(HouseHoldClient);
                break;
            }

            return(ro);
        }
        public async Task <RO <Client> > CustomerMove([FromBody] MovedClientData movedClient)
        {
            var ro = new RO <Client>();

            var result = await VendorDL.CustomerMove(movedClient);

            if (result != null)
            {
                ro.ReturnCode  = 0;
                ro.ReturnValue = result;
            }
            else
            {
                ro.ReturnCode = 100;
            }
            return(ro);
        }
Exemple #16
0
        public async Task <RO <ExtendedEventList> > ExtendedEventPoll(ExtendedEventPollData parameters)
        {
            var ro = new RO <ExtendedEventList>();

            if (ModelState.IsValid)
            {
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.GetExtendedEventPoll(parameters);
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - ExtendedEventPoll - Incorrect parameters: {message}";
            }
            return(ro);
        }
Exemple #17
0
        public async Task <RO <string> > AccessPointOutOfOrder(AccessPointOutOfOrderData accessPoint)
        {
            var ro = new RO <string>();

            if (ModelState.IsValid)
            {
                ro = await VendorDL.AccessPointOutOfOrder(accessPoint);
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                ro.ReturnCode = 60;
                ro.Message    = $"Bad request - AccessPointOutOfOrder - Incorrect parameters: {message}";
            }
            return(ro);
        }
        public async Task <RO <string> > CardDelete([FromBody] CardData card)
        {
            var ro = new RO <string>();

            if (ModelState.IsValid)
            {
                //	ro = await VendorDL.CardStatusChanged(card, true, true);
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CardDelete(card);
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CardDelete - Incorrect parameters: {message}";
            }
            return(ro);
        }
Exemple #19
0
        public static async Task <RO <string> > CardStatusChanged(CardData changedCard, bool blocked, bool deleted)
        {
            var ro = new RO <string> {
                ReturnValue = string.Empty, ReturnCode = 0, Message = string.Empty
            };

            var cards = _db.GetCollection <DBCard>("cards");

            var card = cards.FindOne(c => c.RFID.Equals(changedCard.RFID));

            // In production - if a card has status D = deleted it should NOT be possible to reactivate it......

            card.Blocked = blocked;
            card.Deleted = deleted;
            cards.Update(card);

            return(await Task.FromResult(ro));
        }
        public ActionResult PartialROEdit(RO obj)
        {
            try
            {
                int temp = -1;
                if (ModelState.IsValid)
                {
                    // Возможно 3 случая - если реидентификация
                    // добавление для анализа (sampleId - mbAnalysisId)
                    // сохранение (roId)
                    // добавление для образца (sampleId)


                    if ((obj.SampleID != -1) && (obj.MBAnalysisID != -1) && (obj.ROID == -1))
                    {
                        // добавление для анализа
                        db.AddRO(obj);
                        ModelState.Clear();
                        string strMessage = "Изменения в реидентификации применены успешно";
                        return(RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, sampleId = obj.SampleID, showRO = 1, message = strMessage }));
                    }
                    // if ((roId != -1) && (sampleId == -1) && (mbAnalysisId == -1))
                    if ((obj.ROID != 0) && (obj.SampleID != -1) && (obj.MBAnalysisID != -1))
                    {
                        // сохранение из анализа
                        db.EditRO(obj);
                        ModelState.Clear();
                        string strMessage = "Изменения в реидентификации применены успешно";
                        return(RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, sampleId = obj.SampleID, showRO = 1, message = strMessage }));
                    }
                }
                else
                {
                    string strMessage = "Ошибка. Изменения в реидентификации сохранить не удалось";
                    return(RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, sampleId = obj.SampleID, showRO = 1, message = strMessage }));
                }
                return(RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, sampleId = obj.SampleID, showRO = 1, message = "" }));
            }
            catch (DataException ex)
            {
                string strMessage = "Ошибка " + ex.Message + ". Изменения в реидентификации сохранить не удалось";
                return(RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, sampleId = obj.SampleID, showRO = 1, message = strMessage }));
            }
        }
Exemple #21
0
        public static async Task <RO <CardList> > CardList(CurrentClientData currentClient)
        {
            var ro = new RO <CardList> {
                ReturnCode = 0, Message = string.Empty
            };

            _db.GetCollection <DBCard>("cards");
            var clientList = _db.GetCollection <DBClient>("clients").Include(x => x.Cards);

            IEnumerable <DBClient> clients = null;
            DBClient client = null;

            clients = currentClient.InstallationID != "NA" ?
                      clientList.Find(a => a.InstallationID.Equals(currentClient.InstallationID) && a.Id.Equals(int.Parse(currentClient.CustomerKey))) :
                      clientList.Find(a => a.Id.Equals(int.Parse(currentClient.CustomerKey)));

            if (clients != null)
            {
                client = clients.FirstOrDefault();
            }

            if (client != null)
            {
                var cardsList = client.Cards.Where(c => c.Deleted).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card
                {
                    rfid   = c.RFID,
                    status = "D"
                }).Concat(client.Cards.Where(c => c.Blocked && c.Deleted == false).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card
                {
                    rfid   = c.RFID,
                    status = "B"
                })).Concat(client.Cards.Where(c => c.Blocked == false && c.Deleted == false).Select(c => new BossIDWS.Vendor.REST.ReturnObjects.Card
                {
                    rfid   = c.RFID,
                    status = "A"
                })).ToList();

                //var cards = new CardList { Cards = cardsList };
                var cards = new CardList();
                ro.ReturnValue = cards;
            }

            return(await Task.FromResult(ro));
        }
        public async Task <RO <CardList> > CardList([FromBody] CurrentClientData client)
        {
            var ro = new RO <CardList>();

            if (ModelState.IsValid)
            {
                // ro = await VendorDL.CardList(client);
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CardList(client);
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CardList - Incorrect parameters: {message}";
            }
            return(ro);
        }
Exemple #23
0
 private static void TripleQ(Obj_AI_Hero target)
 {
     if (target.IsValidTarget())
     {
         if (_player.Mana == 5 && R.IsReady() && _player.Distance(target) <= R.Range && Q.IsReady())
         {
             R.Cast();
         }
         if (_player.Mana == 5 && _player.HasBuff("RengarR") && _player.Distance(target) <= Q.Range)
         {
             CastQ(target);
         }
         if (_player.Mana == 5 && !_player.HasBuff("RengarR") && _player.Distance(target) <= Q.Range)
         {
             CastQ(target);
         }
         if (_player.Mana <= 4)
         {
             if (_player.Distance(target) <= Q.Range)
             {
                 CastQ(target);
             }
             if (_player.Distance(target) <= W.Range)
             {
                 CastW(target);
             }
             if (_player.Distance(target) <= E.Range)
             {
                 CastE(target);
             }
         }
         if (_player.Distance(target) < _player.AttackRange + 50)
         {
             TMT.Cast();
             HYD.Cast();
             STD.Cast();
         }
         BWC.Cast(target);
         BRK.Cast(target);
         RO.Cast(target);
         YMG.Cast();
     }
 }
Exemple #24
0
        private static void Harass()
        {
            var target = SimpleTs.GetTarget(E.Range, SimpleTs.DamageType.Physical);

            if (target.IsValidTarget())
            {
                if (_player.Mana <= 4)
                {
                    if (SKOMenu.Item("UseWH").GetValue <bool>() && _player.Distance(target) <= W.Range)
                    {
                        CastW(target);
                    }
                    if (SKOMenu.Item("UseEH").GetValue <bool>() && _player.Distance(target) <= E.Range)
                    {
                        CastE(target);
                    }
                }
                if (_player.Mana == 5)
                {
                    if (SKOMenu.Item("UseWH").GetValue <bool>() && SKOMenu.Item("HPrio").GetValue <StringList>().SelectedIndex == 0)
                    {
                        CastW(target);
                    }
                    if (SKOMenu.Item("UseEH").GetValue <bool>() && SKOMenu.Item("HPrio").GetValue <StringList>().SelectedIndex == 1)
                    {
                        CastE(target);
                    }
                }
                if (SKOMenu.Item("UseItemsHarass").GetValue <bool>())
                {
                    if (_player.Distance(target) < _player.AttackRange + 50)
                    {
                        TMT.Cast();
                        HYD.Cast();
                        STD.Cast();
                    }
                    BWC.Cast(target);
                    BRK.Cast(target);
                    RO.Cast(target);
                    YMG.Cast();
                }
            }
        }
Exemple #25
0
 private static void Harass(Obj_AI_Hero target)
 {
     if (target.IsValidTarget())
     {
         if (Player.Mana <= 4)
         {
             if (SKOMenu.Item("UseWH").GetValue <bool>() && W.IsReady() && Player.Distance(target) <= W.Range)
             {
                 W.Cast();
             }
             if (SKOMenu.Item("UseEW").GetValue <bool>() && E.IsReady() && Player.Distance(target) <= E.Range)
             {
                 E.Cast(target, PacketCast);
             }
         }
         if (Player.Mana == 5)
         {
             if (SKOMenu.Item("UseWH").GetValue <bool>() && SKOMenu.Item("HPrio").GetValue <StringList>().SelectedIndex == 0 && W.IsReady())
             {
                 W.Cast();
             }
             if (SKOMenu.Item("UseEH").GetValue <bool>() && SKOMenu.Item("HPrio").GetValue <StringList>().SelectedIndex == 0 && E.IsReady())
             {
                 E.Cast(target, PacketCast);
             }
         }
         if (SKOMenu.Item("UseItemsHarass").GetValue <bool>())
         {
             if (Player.Distance(target) < Player.AttackRange + 50)
             {
                 TMT.Cast();
                 HYD.Cast();
                 STD.Cast();
             }
             BWC.Cast(target);
             BRK.Cast(target);
             RO.Cast(target);
             YMG.Cast();
         }
     }
 }
        public async Task <RO <string> > CardNew([FromBody] CardData newCard)
        {
            var ro = new RO <string>();

            //#if SESAM
            //#else
            if (ModelState.IsValid)
            {
                //ro = await VendorDL.CardNew(newCard);
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.CardNew(newCard);
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = 100;
                ro.Message    = $"Bad request - CardNew - Incorrect parameters: {message}";
            }
            //#endif
            return(ro);
        }
Exemple #27
0
        public static async Task <RO <string> > CardNew(CardData cardNew)
        {
            var ro = new RO <string> {
                ReturnValue = string.Empty, ReturnCode = 0, Message = string.Empty
            };

            var cards   = _db.GetCollection <DBCard>("cards");
            var clients = _db.GetCollection <DBClient>("clients");

            var card = new DBCard {
                RFID = cardNew.RFID
            };

            cards.Insert(card);

            var client = clients.FindById(int.Parse(cardNew.CustomerKey));

            client.Cards.Add(card);
            clients.Update(client);

            return(await Task.FromResult(ro));
        }
Exemple #28
0
        private static void Combo(Obj_AI_Hero target)
        {
            if (target != null)
            {
                if (Config.Item("UseECombo").GetValue <bool>() && E.IsReady() && Player.Distance(target) <= Q.Range)
                {
                    E.Cast(target, true);
                }
                if (Config.Item("UseQCombo").GetValue <bool>() && Q.IsReady())
                {
                    Q.Cast(target, true);
                }
                if (Config.Item("UseWCombo").GetValue <bool>() && W.IsReady())
                {
                    W.Cast(target);
                }

                if (Config.Item("UseRCombo").GetValue <bool>() && R.IsReady() && !ult)
                {
                    if (GetEnemys(target) >= Config.Item("MinEnemys").GetValue <Slider>().Value)
                    {
                        R.Cast(target);
                    }
                }
                if (Config.Item("UseItems").GetValue <bool>())
                {
                    BKR.Cast(target);
                    YOU.Cast(target);
                    BWC.Cast(target);
                    DFG.Cast(target);
                    SOD.Cast(target);
                    RO.Cast(target);
                    HDR.Cast(target);
                    TMT.Cast(target);
                }
            }
        }
Exemple #29
0
        private void convert_Click_1(object sender, EventArgs e)
        {
            help1.Visible = false;
            help2.Visible = false;
            help3.Visible = false;
            help4.Visible = false;
            help5.Visible = false;
            help6.Visible = false;

            {
                #region octa to decimal
                //make a string based on user input

                String Octal     = input.Text;
                int    octLength = Octal.Length;
                double dec       = 0;

                for (int i = 0; i < octLength; ++i)
                {
                    dec += ((byte)Octal[i] - 48) * Math.Pow(8, ((octLength - i) - 1));
                }

                string ans = Convert.ToString(dec);
                Decimal.Text = ans;
                #endregion
                // ans is decimal number use this to calculate the rest
                //found decimal and use previous code to calculate the rest
                #region Decimal to Hexa
                int  Y;
                bool numcheck = int.TryParse(input.Text, out Y);
                zz.Text = Convert.ToString(Y, 16);
                #endregion
                #region decimal to binary
                int  x;
                int  RU;
                int  RO;
                bool Numcheck = int.TryParse(input.Text, out x);



                if (input.Text == "")
                {
                    MessageBox.Show("Please enter integers");
                }
                else
                {
                    int[] BinUnder255 = new int[8] {
                        0, 0, 0, 0, 0, 0, 0, 0
                    };

                    if (Numcheck)
                    {
                        if (x <= 255)
                        {
                            for (int i = 0; i < 8; i++)
                            {
                                RU             = x % 2;
                                x             /= 2;
                                BinUnder255[i] = RU;
                            }
                        }
                        Array.Reverse(BinUnder255);
                        BinaryOutput.Text = Convert.ToString(BinUnder255[0]) + Convert.ToString(BinUnder255[1]) + Convert.ToString(BinUnder255[2])
                                            + Convert.ToString(BinUnder255[3]) + Convert.ToString(BinUnder255[4]) + Convert.ToString(BinUnder255[5])
                                            + Convert.ToString(BinUnder255[6]) + Convert.ToString(BinUnder255[7]);
                    }
                    else if (x > 255)
                    {
                        String Binover255 = string.Empty;
                        while (x > 0)
                        {
                            RO         = x % 2;
                            x         /= 2;
                            Binover255 = RO.ToString() + Binover255;
                        }
                        BinaryOutput.Text = Binover255;
                    }
                }
                #endregion
                #region decimal to text
                {
                    {
                        {
                            string tempString = "";
                            string Character  = System.Text.RegularExpressions.Regex.Replace(BinaryOutput.Text, "[^01]", "");
                            byte[] Bytes      = new byte[(Character.Length / 8) - 1 + 1];
                            for (int Index = 0; Index <= Bytes.Length - 1; Index++)
                            {
                                Bytes[Index] = Convert.ToByte(Character.Substring(Index * 8, 8), 2);
                            }
                            tempString = (string)(System.Text.ASCIIEncoding.ASCII.GetString(Bytes));
                            xx.Text    = tempString;
                        }
                    }
                }
                #endregion
            }
        }
Exemple #30
0
        private static void Game_OnGameUpdate(EventArgs args)
        {
            if (SKOMenu.Item("activeClear").GetValue <KeyBind>().Active)
            {
                Clear();
            }
            var tqtarget = SimpleTs.GetTarget(R.Range, SimpleTs.DamageType.Physical);

            if (SKOMenu.Item("TripleQ").GetValue <KeyBind>().Active)
            {
                TripleQ(tqtarget);
            }

            var target = SimpleTs.GetTarget(E.Range, SimpleTs.DamageType.Physical);

            Q   = new Spell(SpellSlot.Q, Player.AttackRange + 90);
            YMG = new Items.Item(3142, Player.AttackRange + 50);
            STD = new Items.Item(3131, Player.AttackRange + 50);

            AutoHeal();
            KillSteal(target);

            if (SKOMenu.Item("activeCombo").GetValue <KeyBind>().Active)
            {
                if (target.IsValidTarget())
                {
                    if (Player.Mana <= 4)
                    {
                        if (SKOMenu.Item("UseQ").GetValue <bool>() && Q.IsReady() && Player.Distance(target) <= Q.Range)
                        {
                            Q.Cast();
                        }
                        if (SKOMenu.Item("UseW").GetValue <bool>() && W.IsReady() && Player.Distance(target) <= W.Range)
                        {
                            W.Cast();
                        }
                        if (SKOMenu.Item("UseE").GetValue <bool>() && E.IsReady() && Player.Distance(target) <= E.Range)
                        {
                            E.Cast(target, PacketCast);
                        }
                    }
                    if (Player.Mana == 5)
                    {
                        if (SKOMenu.Item("UseQ").GetValue <bool>() && SKOMenu.Item("CPrio").GetValue <StringList>().SelectedIndex == 0 && Q.IsReady() && Player.Distance(target) <= Q.Range)
                        {
                            Q.Cast();
                        }
                        if (SKOMenu.Item("UseW").GetValue <bool>() && SKOMenu.Item("CPrio").GetValue <StringList>().SelectedIndex == 1 && W.IsReady() && Player.Distance(target) <= W.Range)
                        {
                            W.Cast();
                        }
                        if (SKOMenu.Item("UseE").GetValue <bool>() && SKOMenu.Item("CPrio").GetValue <StringList>().SelectedIndex == 2 && E.IsReady() && Player.Distance(target) <= E.Range)
                        {
                            E.Cast(target);
                        }

                        //E if !Q.IsReady()
                        if (SKOMenu.Item("UseE").GetValue <bool>() && !Q.IsReady() && E.IsReady() && Player.Distance(target) > Q.Range)
                        {
                            E.Cast(target);
                        }
                    }
                    if (SKOMenu.Item("UseItemsCombo").GetValue <bool>())
                    {
                        if (Player.Distance(target) < Player.AttackRange + 50)
                        {
                            TMT.Cast();
                            HYD.Cast();
                            STD.Cast();
                        }
                        BWC.Cast(target);
                        BRK.Cast(target);
                        RO.Cast(target);
                        YMG.Cast();
                    }
                }
            }
            if (SKOMenu.Item("activeHarass").GetValue <KeyBind>().Active)
            {
                Harass(target);
            }
        }