Пример #1
0
 public Response SaveDataInDynamoDb(IdentityTaskData identityTaskData)
 {
     try
     {
         if (null == Table)
         {
             return(new Response(false, "Table not Found"));
         }
         foreach (var identityEmail in identityTaskData.SelectedIdentities)
         {
             var identitytaskname = Table.GetItem(identityTaskData.TaskName);
             if (null == identitytaskname)
             {
                 string   jsonText = JsonConvert.SerializeObject(identityTaskData);
                 var      item     = Document.FromJson(jsonText);
                 Document response = Table.PutItem(item);
             }
             else
             {
                 string   jsonText = JsonConvert.SerializeObject(identityTaskData);
                 Document item     = Document.FromJson(jsonText);
                 Document response = Table.UpdateItem(item);
             }
         }
         return(new Response(true, "Table updated"));
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception.Message);
         return(new Response(false, exception.Message));
     }
 }
Пример #2
0
        private List <IdentityTaskData> CovertresponseIntoJSON(ScanResponse response)
        {
            List <Dictionary <string, AttributeValue> > result = response.Items;
            List <IdentityTaskData> identityList = new List <IdentityTaskData>();
            IdentityTaskData        identity     = new IdentityTaskData();

            foreach (Dictionary <string, AttributeValue> items in result)
            {
                List <string> listofselectedIdentities = new List <string>();
                List <string> listofSelectedGames      = new List <string>();
                Dictionary <string, string> item       = new Dictionary <string, string>();
                foreach (var val in items)
                {
                    if (val.Key == "SelectedIdentities")
                    {
                        foreach (var web in val.Value.L)
                        {
                            if (!listofselectedIdentities.Contains(web.S))
                            {
                                listofselectedIdentities.Add(web.S);
                            }
                        }
                    }
                    if (val.Key == "SelectedGames")
                    {
                        foreach (var web in val.Value.L)
                        {
                            if (!listofSelectedGames.Contains(web.S))
                            {
                                listofSelectedGames.Add(web.S);
                            }
                        }
                    }
                    item.Add(val.Key, val.Value.S);
                }
                string jsonString = JsonConvert.SerializeObject(item, Formatting.Indented);
                identity = JsonConvert.DeserializeObject <IdentityTaskData>(jsonString);
                identity.SelectedIdentities = listofselectedIdentities;
                identity.SelectedGames      = listofSelectedGames;
                identityList.Add(identity);
            }
            return(identityList);
        }
Пример #3
0
        internal IdentityTaskData ConvertToTitleCase(IdentityTaskData identityData)
        {
            TextInfo      textInfo      = new CultureInfo("en-US", false).TextInfo;
            List <string> listgames     = new List <string>();
            List <string> listIdentites = new List <string>();

            //identityData.BalanceLimit = textInfo.ToTitleCase(identityData.BalanceLimit);
            //identityData.BalanceTarget = textInfo.ToTitleCase(identityData.BalanceTarget);
            //identityData.BetSize = textInfo.ToTitleCase(identityData.BetSize);
            //identityData.BetSizeOption = textInfo.ToTitleCase(identityData.BetSizeOption);
            //identityData.Email = textInfo.ToTitleCase(identityData.Email);
            //identityData.MaxBetSize = textInfo.ToTitleCase(identityData.MaxBetSize);
            //identityData.Section = textInfo.ToTitleCase(identityData.Section);
            //identityData.SelectBrowser = textInfo.ToTitleCase(identityData.SelectBrowser);
            //identityData.SelectMode = textInfo.ToTitleCase(identityData.SelectMode);
            identityData.SelectTask = textInfo.ToTitleCase(identityData.SelectTask);
            //identityData.StopLoss = textInfo.ToTitleCase(identityData.StopLoss);
            identityData.TaskName = textInfo.ToTitleCase(identityData.TaskName);
            //identityData.TaskWebsite = textInfo.ToTitleCase(identityData.TaskWebsite);
            //identityData.WagerAmount = textInfo.ToTitleCase(identityData.WagerAmount);
            //if ( identityData.SelectedGames.Count > 0 )
            //    {

            //    foreach ( string game in identityData.SelectedGames )
            //        {
            //        listgames.Add(textInfo.ToTitleCase(game));
            //        }

            //    }
            //identityData.SelectedGames = listgames;
            //if ( identityData.SelectedIdentities.Count > 0 )
            //    {

            //    foreach ( var identity in identityData.SelectedIdentities )
            //        {
            //        listIdentites.Add(textInfo.ToTitleCase(identity));
            //        }

            //    }
            //identityData.SelectedIdentities = listIdentites;
            return(identityData);
        }
Пример #4
0
        internal IdentityTaskData ConvertToLowerCase(IdentityTaskData identityData)
        {
            List <string> listgames     = new List <string>();
            List <string> listIdentites = new List <string>();

            //identityData.BalanceLimit = identityData.BalanceLimit.ToLower();
            //identityData.BalanceTarget = identityData.BalanceTarget.ToLower();
            //identityData.BetSize = identityData.BetSize.ToLower();
            //identityData.BetSizeOption = identityData.BetSizeOption.ToLower();
            //identityData.MaxBetSize = identityData.MaxBetSize.ToLower();
            //identityData.Section = identityData.Section.ToLower();
            //identityData.SelectBrowser = identityData.SelectBrowser.ToLower();
            //identityData.SelectMode = identityData.SelectMode.ToLower();
            identityData.SelectTask = identityData.SelectTask.ToLower();
            //identityData.StopLoss = identityData.StopLoss.ToLower();
            identityData.TaskName    = identityData.TaskName.ToLower();
            identityData.TaskWebsite = identityData.TaskWebsite.ToLower();
            //identityData.WagerAmount = identityData.WagerAmount.ToLower();
            //if ( identityData.SelectedGames.Count > 0 )
            //    {

            //    foreach ( string game in identityData.SelectedGames )
            //        {
            //        listgames.Add(game.ToLower());
            //        }

            //    }
            //identityData.SelectedGames = listgames;
            //if ( identityData.SelectedIdentities.Count > 0 )
            //    {

            //    foreach ( var identity in identityData.SelectedIdentities )
            //        {
            //        listIdentites.Add(identity.ToLower());
            //        }

            //    }
            //identityData.SelectedIdentities = listIdentites;
            return(identityData);
        }