コード例 #1
0
        /// <summary>
        /// Write Notification Details To Table Storage
        /// </summary>
        /// <param name="tenantClient"></param>
        /// <param name="fileID"></param>
        /// <param name="fileUploadStatus"></param>
        public bool WriteNotificationToStorage(string TenantId,String fileID, String fileUploadStatus, string notificationMode, string recipientDetail, bool isNotified)
        {
            try
            {
                bool notifyStatus = false;
                string notificationStatusTableName = eZeeFlow.Common.Constants.notificationStatusTableName;
                string timeString = (DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks).ToString("d19");
                TenantEntity tenant = new TenantEntity(TenantId, timeString);
                tenant.FileID = fileID;
                tenant.FileUploadStatus = fileUploadStatus;
                tenant.NotificationMode = notificationMode;
                tenant.RecipientDetail = recipientDetail;
                tenant.IsNotified = isNotified;

                TableHelper _tableHelper = new TableHelper(Common.Constants.StorageConnectionString);
                notifyStatus = _tableHelper.InsertEntity(notificationStatusTableName, tenant);

                return notifyStatus;
            }
            catch (Exception ex)
            {
                DataHubTraceListener traceListener = new DataHubTraceListener();
                traceListener.WriteLog(Categories.Error, "Eventing", ex.Message.ToString(), ex.StackTrace.ToString());
                return false;
            }
        }
コード例 #2
0
    public AudibleFileLoader(TableHelper tc,BlobHelper bh)
    {
        m_TableHelper = tc;
            m_LogBlob = bh;
            m_TableHelper.CreateTable("ISBN");

            m_LogBlob.CreateContainer("log");
            //m_LogBlob.SetContainerACL("log", "private");
            CloudBlobContainer container = m_LogBlob.BlobClient.GetContainerReference("log");
        /*
            CloudBlobContainer blobContainer = blobClient.GetContainerReference("azurecontainer");
            CloudBlob blob = Container.GetBlobReference(blobname + ".res");
            BlobStream bs = blob.OpenWrite();
            TextWriter tw = new StreamWriter(bs);
            string append = resultsLine + ", ";
            tw.WriteLine(append);
        */

            CloudBlob blob = container.GetBlobReference("AudibleLoader.Log");
            BlobStream bs = blob.OpenWrite();
            TextWriter tw = new StreamWriter(bs);
            tw.WriteLine("test");
            tw.Flush();
            //content = new UTF8Encoding().GetString(data);
            bs.Close();
            //BlobStream OpenWrite ()
    }
コード例 #3
0
 // Delete a help session form the table storage
 public static void Delete(string sessionId)
 {
     var entity = new HelpSessionDataType();
     entity.PartitionKey = sessionId;
     entity.RowKey = "";
     var helper = new TableHelper(Settings.StorageAccountConnection, tablename);
     helper.DeleteIfPresent<HelpSessionDataType>(entity, true);
 }
コード例 #4
0
        //Insert help session into the table storage
        public static void InsertOrUpdate(HelpSessionDataType entity)
        {
            //entity.PartitionKey = Settings.MainHost;
            entity.RowKey = "";

            var helper = new TableHelper(Settings.StorageAccountConnection, tablename);
            helper.InsertOrReplace<HelpSessionDataType>(entity);
        }
コード例 #5
0
        public async Task UpdateChannel(string Role = "INVALID CHANNEL", SocketTextChannel Channel = null)
        {
            var Me = Context.Guild.CurrentUser;

            StringBuilder sb = new StringBuilder();

            if (System.Enum.TryParse(Role, true, out WarBotChannelType chType))
            {
                if (Channel == null)
                {
                    //Get the using attribute
                    var usage = this.GetType().GetCustomAttributes(typeof(CommandUsageAttribute), false)
                                .OfType <CommandUsageAttribute>()
                                .FirstOrDefault()
                                .Usage;
                    sb.AppendLine("Please remember to tag a channel for this command. Proper Syntex:")
                    .AppendLine(usage);
                }
                else
                {
                    cfg.SetGuildChannel(chType, Channel);

                    await cfg.SaveConfig();

                    sb.AppendLine($"Channel {Channel.Mention} has been assigned for purpose {chType.ToString()}");
                }
            }
            else
            {
                //Was unable to parse a channel type from the input text.
                sb.AppendLine("I was unable to parse the desired channel type from your input. The accepted values are:");
                var validValues = Enum.GetValues(typeof(WarBotChannelType))
                                  .OfType <WarBotChannelType>()
                                  .Select(o => new
                {
                    Name    = o.ToString(),
                    Summary = o.GetEnumDescriptionAttribute()
                });

                var table = TableHelper.FormatTable(validValues);


                sb.AppendLine($"```\r\n{table}\r\n```");
            }

            //Send the formatted return message.
            await ReplyAsync(sb.ToString());
        }
コード例 #6
0
ファイル: Contest.cs プロジェクト: dovanduy/titan
        public List <ContestParticipant> GetAllMembersParticipating()
        {
            var where = TableHelper.MakeDictionary("ContestId", this.Id);
            var AllParticipants = TableHelper.GetListFromQuery <ContestParticipant>(@"INNER JOIN Users ON ContestParticipants.Username = Users.Username
                WHERE ContestParticipants.ContestId = " + this.Id + @" AND (Users.AccountStatusInt IN (1,9,10));");

            if (this.Type == ContestType.Direct && (this.ClicksReferallsRestriction > 0 || this.AdPackReferrallsPurchaseRestriction > 0))
            {
                Dictionary <string, int> Referals = new Dictionary <string, int>();
                var ListUsers = TableHelper.GetListFromQuery <Member>(@"INNER JOIN ContestParticipants On ContestParticipants.Username = Users.Referer WHERE IsRented = 0 
                    AND RegisterDate >='" + this.DateStart + @"' AND ContestId =" + this.Id + " AND TotalClicks >=" + this.ClicksReferallsRestriction + ";");

                foreach (var user in ListUsers)
                {
                    if ((user.Status == MemberStatus.Active || user.Status == MemberStatus.AwaitingSMSPIN ||
                         user.Status == MemberStatus.VacationMode) &&
                        user.ExpiredAdPacks + user.ActiveAdPacks >= this.AdPackReferrallsPurchaseRestriction)
                    {
                        if (Referals.ContainsKey(user.Referer))
                        {
                            Referals[user.Referer] += 1;
                        }
                        else
                        {
                            Referals.Add(user.Referer, 1);
                        }
                    }
                }

                var resultParticipants = new List <ContestParticipant>();

                foreach (var participant in AllParticipants)
                {
                    if (Referals.ContainsKey(participant.Username))
                    {
                        participant.Points = new Money(Referals[participant.Username]);
                        resultParticipants.Add(participant);
                    }
                }

                return(resultParticipants);
            }
            else if (this.Type == ContestType.Forum)
            {
                AllParticipants = ForumContestHelper.GetForumParticipants(this);
            }
            return(AllParticipants);
        }
コード例 #7
0
        public static DataTable makeCounterSamplesTable()
        {
            var table = new DataTable(TABLE_NAME);

            //TableHelper.addColumn(table, "id", "System.Int32", true, true);
            TableHelper.addColumn(table, "timestamp", "System.DateTime");
            TableHelper.addColumn(table, "machine");
            TableHelper.addColumn(table, "category");
            TableHelper.addColumn(table, "instance");

            TableHelper.addColumn(table, "name");
            TableHelper.addColumn(table, "value", "System.Double");


            return(table);
        }
コード例 #8
0
ファイル: DiceGameManager.cs プロジェクト: dovanduy/titan
    public static int GetTotalWinsLosses(bool isWin, int?userId = null)
    {
        string and  = string.Empty;
        string sign = ">";

        if (!isWin)
        {
            sign = "<";
        }
        if (userId.HasValue)
        {
            and = string.Format("AND UserId = {0}", userId.ToString());
        }

        return(Convert.ToInt32(TableHelper.SelectScalar(string.Format("SELECT COUNT(*) FROM UserBets WHERE Profit {0} 0 {1};", sign, and))));
    }
コード例 #9
0
        public static void UpdatePlansNumbers()
        {
            var query      = string.Format(@"SELECT * FROM {0} WHERE [Status] != {1} ORDER BY [Number]", InvestmentPlatformPlan.TableName, (int)UniversalStatus.Deleted);
            var types      = TableHelper.GetListFromRawQuery <InvestmentPlatformPlan>(query);
            var number     = 1;
            var resetQuery = string.Format("UPDATE {0} SET {1} = 0", InvestmentPlatformPlan.TableName, InvestmentPlatformPlan.Columns.Number);

            TableHelper.ExecuteRawCommandNonQuery(resetQuery);

            foreach (var type in types)
            {
                type.Number = number;
                type.Save();
                number++;
            }
        }
コード例 #10
0
        public static void OutputListToConsole(IEnumerable <Person> sortedList)
        {
            TableHelper th = new TableHelper();

            th.TextAlignment = TableHelper.AlignText.ALIGN_RIGHT;
            th.SetHeaders(new string[] { "First Name", "Last Name", "Gender", "Color", "Date of Birth" });
            foreach (var person in sortedList)
            {
                th.AddRow(new List <string> {
                    person.FirstName, person.LastName, person.Gender, person.FavoriteColor, person.DateOfBirth.ToString("MM/dd/yyyy")
                });
            }
            th.PrintTable();
            WriteRestInstructions();
            Console.ReadLine();
        }
コード例 #11
0
    //might be used in future
    //public static decimal GetUsersShare(Member user)
    //{
    //    int id = user.Id;
    //    decimal share;
    //    string query2 = string.Format("select SUM(Kelly * Amount)/100 from SiteInvestments");
    //    object sum = TableHelper.SelectScalar(query2);
    //    string query = string.Format("select (si.Kelly * si.Amount) from SiteInvestments si WHERE si.UserId = {0}", id);
    //    object mySelect = TableHelper.SelectScalar(query);
    //    if (String.IsNullOrWhiteSpace(mySelect.ToString()))
    //        share = 0;
    //    else

    //    share = (decimal)mySelect / (100 * AppSettings.DiceGame.MaxBitCoinProfitPercent * GetCurrentBankroll());

    //    return share;
    //}

    public static Money GetCurrentBankroll()
    {
        Money  bankroll;
        string query    = string.Format("SELECT SUM(Amount) from SiteInvestments;");
        object mySelect = TableHelper.SelectScalar(query);

        if (mySelect is DBNull)
        {
            bankroll = Money.Zero;
        }
        else
        {
            bankroll = Money.Parse(mySelect.ToString());
        }
        return(bankroll);
    }
コード例 #12
0
        public static List <Article> Get(ArticleFilter filter)
        {
            var categoryWhere = filter.CategoryId >= 0 ? String.Format(" AND CategoryId = {0}", filter.CategoryId) : String.Empty;
            var searchText    = !String.IsNullOrEmpty(filter.SearchText) ? String.Format(
                " AND (Title LIKE '%{0}%' OR Keywords LIKE '%{0}%' OR ShortDescription LIKE '%{0}%')", filter.SearchText)
                : String.Empty;


            var query = String.Format(
                "SELECT * FROM Articles WHERE StatusInt = {0} AND Geolocation = '{3}'{4}{5} AND CreatedDate >= '{1}' ORDER BY Clicks DESC, CreatedDate DESC "
                + "OFFSET {6} ROWS FETCH NEXT {2} ROWS ONLY",
                (int)AdvertStatus.Active, AppSettings.ServerTime.AddDays(-filter.LastDays).ToDBString(), filter.FirstResults,
                filter.CountryCode, categoryWhere, searchText, filter.SkipFirst);

            return(TableHelper.GetListFromRawQuery <Article>(query));
        }
コード例 #13
0
        public static bool IsRestrictionForEachRank()
        {
            var querry = string.Format(@"SELECT {0} FROM {1} WHERE {0} NOT IN (SELECT {2} FROM {3})",
                                       LeadershipRank.Columns.Rank, LeadershipRank.TableName, LeadershipRankRequirements.Columns.Rank,
                                       LeadershipRankRequirements.TableName);
            var count = TableHelper.SelectScalar(querry);

            if (count == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #14
0
        private void CreateClass(NormalModel temp)
        {
            string result = string.Empty;

            try
            {
                // 创建类代码
                TableHelper tableHelper = new TableHelper(true, true, true);
                result = tableHelper.GetClassString(temp);
                this.txtClassCode.Text = result;
            }
            catch (Exception ex)
            {
                this.txtClassCode.Text = ex.ToString();
            }
        }
コード例 #15
0
        public static void CheckFinishedLeader()
        {
            var leaderGroups = TableHelper.GetListFromRawQuery <UserCustomGroup>("SELECT * FROM UserCustomGroups WHERE Status = 3 AND GotBonus = 0");

            foreach (var leaderGroup in leaderGroups)
            {
                Money  returned = GetTotalCustomGroupsEarningsNoOwner(leaderGroup.Id, leaderGroup.CreatorUserId);
                Member Creator  = new Member(leaderGroup.CreatorUserId);

                //leaderGroup.GotBonus = true;
                leaderGroup.Save();

                Creator.AddToMainBalance(Money.MultiplyPercent(returned, Creator.GetLeaderBonusPercent()), "Leader bonus");
                Creator.SaveBalances();
            }
        }
コード例 #16
0
        public static List <FriendshipRequest> GetFriendshipRequests(this Member user, bool byMe)
        {
            StringBuilder query  = new StringBuilder();
            string        target = "SenderId";

            if (!byMe)
            {
                target = "RecipientId";
            }

            query.Append("SELECT * FROM FriendshipRequests WHERE ");
            query.Append(target + " = ");
            query.Append(user.Id);
            query.Append(" ORDER BY DateTime DESC;");
            return(TableHelper.GetListFromRawQuery <FriendshipRequest>(query.ToString()));
        }
コード例 #17
0
    public static BitcoinWithdrawalFeePacks GetFeePackForUser(int userId)
    {
        var daysFromLastWithdrawal = GetDaysFromLastWithdrawal(userId);

        try
        {
            int weeks = daysFromLastWithdrawal / 7;
            var query = string.Format("SELECT TOP 1 * FROM BitcoinWithdrawalFeePacks WHERE WeeksDelay <= {0} ORDER BY WeeksDelay DESC", weeks);
            return(TableHelper.GetListFromRawQuery <BitcoinWithdrawalFeePacks>(query)[0]);
        }
        catch (Exception e)
        {
            ErrorLogger.Log(e);
            return(new BitcoinWithdrawalFeePacks());
        }
    }
コード例 #18
0
    private void PrepareAdPackPositions()
    {
        var adpackTypesList = TableHelper.GetListFromRawQuery(string.Format("SELECT AdPackTypeId FROM AdPacks WHERE UserId = {0}", User.Id));

        foreach (var type in adpackTypesList)
        {
            if (adPackTypesPositions.ContainsKey(type))
            {
                adPackTypesPositions[type]++;
            }
            else
            {
                adPackTypesPositions.Add(type, 1);
            }
        }
    }
コード例 #19
0
ファイル: ReportsToExcel.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Obtiene un reporte de Premanifest With Gifts en Formato de Excel
        /// </summary>
        /// <param name="premanifest">Listado con Premanifest With Gifts</param>
        /// <history>
        /// [ecanul] 19/04/2016 Created
        /// [jorcanche]  se agrego para abrir el archivo despues de guardar
        /// </history>
        public static async void PremanifestWithGiftsToExcel(List <RptPremanifestWithGifts> withGifts, Window window)
        {
            filters = new List <Tuple <string, string> >();
            dt      = new DataTable();
            filters.Add(Tuple.Create("Lead Source", Context.User.LeadSource.lsID));
            DateTime date = BRHelpers.GetServerDate();

            if (withGifts.Count > 0)
            {
                dt      = TableHelper.GetDataTableFromList(withGifts, true);
                rptName = "Premanifest with gifts";
                string dateRange = DateHelper.DateRangeFileName(date, date);

                OpenFile(await ReportBuilder.CreateCustomExcelAsync(dt, filters, rptName, dateRange, clsFormatReports.RptPremanifestWithGifts()), window);
            }
        }
コード例 #20
0
ファイル: CPAOffer.cs プロジェクト: dovanduy/titan
        public bool IsBlockedForMember(int userId)
        {
            var blockedList = TableHelper.SelectRows <CPACategoriesBlocked>(TableHelper.MakeDictionary("UserId", userId));

            bool IsBlocked = false;

            foreach (var blockedElem in blockedList)
            {
                if (blockedElem.CPACategoryId == this.IntCategory)
                {
                    IsBlocked = true;
                }
            }

            return(IsBlocked);
        }
コード例 #21
0
ファイル: BroadcastRemoting.cs プロジェクト: uvbs/FullSource
 public void OnLogToMonitorEvent(string message, LogType type)
 {
     if (mLogMonitorHandler != null)
     {
         try
         {
             mLogMonitorHandler(message, type);
         }
         catch (Exception ex)
         {
             mLogMonitorHandler = null;
             LogHelper help = TableHelper.GetLogHelper(mClientKey);
             help.LogMessage(mClientKey, "LogToMonitor Error: " + ex.Message, LogType.NetWork);
         }
     }
 }
コード例 #22
0
ファイル: CustomGroupManager.cs プロジェクト: dovanduy/titan
    public static int GetUsersHighestExpiredGroupNumber(int userId)
    {
        string query = string.Format(@"SELECT MAX(cg.Number) FROM CustomGroups cg JOIN UserCustomGroups ucg ON cg.Id = ucg.CustomGroupId
WHERE ucg.Status = {0} AND ucg.CreatorUserId = {1}", (int)CustomGroupStatus.Expired, userId);

        int number;

        if (Int32.TryParse(Convert.ToString(TableHelper.SelectScalar(query)), out number))
        {
            return(number);
        }
        else
        {
            return(0);
        }
    }
コード例 #23
0
ファイル: PerfectMoneyHandler.cs プロジェクト: dovanduy/titan
        private static bool CheckIfNotDoneYet(HttpRequest request)
        {
            string sentId = request["PAYMENT_BATCH_NUM"];
            List <CompletedPaymentLog> AllTransations = TableHelper.SelectRows <CompletedPaymentLog>(TableHelper.MakeDictionary("PaymentProcessor", (int)PaymentProcessor.PerfectMoney));
            bool isOk = true;

            foreach (var trans in AllTransations)
            {
                if (trans.TransactionId.Trim() == sentId.Trim())
                {
                    isOk = false;
                }
            }

            return(isOk);
        }
コード例 #24
0
        /// <summary>
        /// Obtiene los datos para exportar a excel el reporte RptStatisticsByExitCloser
        /// </summary>
        /// <param name="report">Nombre del reporte</param>
        /// <param name="fileFullPath">Ruta completa del archivo</param>
        /// <param name="filters">Listado de filtros</param>
        /// <param name="lstReport">Contenido del reporte</param>
        /// <param name="groupedByTeams">Agrupado por equipos</param>
        /// <history>
        ///  [aalcocer] 18/07/2016 Created
        /// </history>
        internal static async Task <FileInfo> RptStatisticsByExitCloser(string report, string fileFullPath, List <Tuple <string, string> > filters, List <RptStatisticsByExitCloser> lstReport, bool groupedByTeams)
        {
            var lstReportAux = new List <dynamic>();

            if (groupedByTeams)
            {
                lstReportAux.AddRange(lstReport.Select(c => new
                {
                    Team = c.TeamN + "   " + c.TeamLeaderN,
                    c.SalesmanStatus,
                    c.SalemanType,
                    c.SalemanID,
                    c.SalemanName,
                    c.SalesAmount,
                    c.OPP,
                    c.UPS,
                    c.SalesAmountRange,
                    c.Sales,
                    c.SalesTotal,
                    c.Efficiency,
                    c.ClosingFactor,
                    c.SaleAverage
                }));
            }
            else
            {
                lstReportAux.AddRange(lstReport.Select(c => new
                {
                    c.SalemanType,
                    c.SalemanID,
                    c.SalemanName,
                    c.SalesAmount,
                    c.OPP,
                    c.UPS,
                    c.SalesAmountRange,
                    c.Sales,
                    c.SalesTotal,
                    c.Efficiency,
                    c.ClosingFactor,
                    c.SaleAverage
                }));
            }

            DataTable dtData = TableHelper.GetDataTableFromList(lstReportAux);

            return(await ReportBuilder.CreateCustomExcelAsync(dtData, filters, report, string.Empty, groupedByTeams?FormatReport.RptStatisticsByExitCloserGroupedByTeams() : FormatReport.RptStatisticsByExitCloser(), blnShowSubtotal : true, blnRowGrandTotal : true, isRptQueue : true, filePath : fileFullPath, isPivot : true, addEnumeration : true));
        }
コード例 #25
0
ファイル: MemberManager.cs プロジェクト: dovanduy/titan
    private static void CreditForNewReferrals()
    {
        var command = string.Format(@"
        BEGIN TRANSACTION
	        DECLARE @UsersToCredit TABLE (UserIdToCredit INT NOT NULL, ReferralId INT NOT NULL, MembershipId INT NOT NULL);
	        INSERT INTO @UsersToCredit 
		        SELECT A.UserId, B.UserId, A.UpgradeId AS Id 
		        FROM Users A 
		        JOIN Users B ON A.Userid = B.ReferrerId 
		        WHERE B.CreditedRefererReward = 0
			        AND B.IsRented = 0
			        AND (A.AccountStatusInt = {0} OR A.AccountStatusInt = {1})
			        AND B.TotalEarned >= (SELECT MinReferralEarningsToCreditReward FROM Memberships WHERE MembershipId = A.UpgradeId)
                    AND (SELECT NewReferralReward FROM Memberships WHERE MembershipId = A.UpgradeId) > 0;


	        DECLARE @IdToCredit INT;
	        DECLARE @ReferralId INT;
	        DECLARE @MembershipId INT;
	        DECLARE @SingleRow TABLE (UserIdToCredit INT NOT NULL, ReferralId INT NOT NULL, MembershipId INT NOT NULL);
	        WHILE EXISTS(SELECT * FROM @UsersToCredit)
		        BEGIN
			        INSERT INTO @SingleRow SELECT TOP 1 * FROM @UsersToCredit;
			        SELECT @IdToCredit = (SELECT TOP 1 UserIdToCredit FROM @SingleRow);
			        SELECT @ReferralId = (SELECT TOP 1 ReferralId FROM @SingleRow);
			        SELECT @MembershipId = (SELECT TOP 1 MembershipId FROM @SingleRow);
			        DECLARE @Reward DECIMAL(19,8);
			        SELECT @Reward = (SELECT NewReferralReward FROM Memberships WHERE MembershipId = @MembershipId);
			        print 'IdToCredit: ' + Convert(nvarchar, @IdToCredit);
			        print 'ReferralId: ' + Convert(nvarchar, @ReferralId);
			        print 'Reward: ' + Convert(nvarchar, @Reward);

			        DECLARE @AccountState DECIMAL(19,8);
			        SELECT @AccountState= (SELECT Balance1 FROM Users WHERE UserId = @IdToCredit);

			        UPDATE Users SET Balance1 = Balance1 + @Reward, TotalEarned = TotalEarned + @Reward, TotalDirectReferralsEarned = TotalDirectReferralsEarned + @Reward WHERE UserId = @IdToCredit;
			        UPDATE Users SET CreditedRefererReward = 1, TotalEarnedToDReferer = TotalEarnedToDReferer + @Reward WHERE UserId = @ReferralId;
			
			        INSERT INTO BalanceLogs VALUES(@IdToCredit, GetDate(), 'New Ref Reward', @Reward, {2}, @AccountState, {3})
			        DELETE FROM @UsersToCredit WHERE ReferralId = @ReferralId;
			        DELETE FROM @SingleRow;
		        END
        COMMIT TRANSACTION",
                                    (int)MemberStatus.Active, (int)MemberStatus.VacationMode, (int)BalanceType.MainBalance, (int)BalanceLogType.Other);

        TableHelper.ExecuteRawCommandNonQuery(command);
    }
コード例 #26
0
        public static void CRON()
        {
            try
            {
                if (!AppSettings.TitanFeatures.AdvertMarketplaceEnabled)
                {
                    return;
                }

                AppSettings.Marketplace.Reload();

                if (AppSettings.Marketplace.MarketplaceFundsExpireAfterDays == -1)
                {
                    return;
                }

                var serverTime = AppSettings.ServerTime.ToDBString();

                var balanceUpdateCommand = string.Format(@"UPDATE Users SET MarketplaceBalance = MarketplaceBalance - 
            (SELECT SUM(Amount) FROM MarketplaceBalanceLogs mbl 
            WHERE mbl.UserId = Users.UserId 
            AND '{0}' > DateAdd(d, {1}, DateAdded))", serverTime, AppSettings.Marketplace.MarketplaceFundsExpireAfterDays);

                var balanceLogsCommand = string.Format(@"SELECT 
	            mbl.UserId AS userId, 
                - SUM(mbl.Amount) AS amount, 
                u.MarketplaceBalance AS state
            FROM MarketplaceBalanceLogs mbl 
            JOIN Users u
	        ON mbl.UserId = u.UserId 
            WHERE '{0}' > DateAdd(d, 10, DateAdded)
            GROUP BY mbl.UserId, u.MarketplaceBalance", serverTime);

                var clearMBLCommand = string.Format(@"DELETE FROM MarketplaceBalanceLogs WHERE '{0}' > DateAdd(d, {1}, DateAdded);",
                                                    serverTime, AppSettings.Marketplace.MarketplaceFundsExpireAfterDays);

                TableHelper.ExecuteRawCommandNonQuery(balanceLogsCommand);

                using (var bridge = ParserPool.Acquire(Database.Client))
                {
                    BalanceLogManager.AddRange(bridge.Instance, balanceLogsCommand, "Balance expiration", BalanceType.MarketplaceBalance, BalanceLogType.Other);
                }

                TableHelper.ExecuteRawCommandNonQuery(clearMBLCommand);
            }
            catch (Exception ex) { ErrorLogger.Log(ex); }
        }
コード例 #27
0
        public static IEnumerable <OpenXmlElement> GetSection(FirstNationsInfo FNInfo)
        {
            List <OpenXmlElement> sectionParts = new List <OpenXmlElement>();

            sectionParts.Add(ParagraphHelper.Paragraph("Students of First Nations Ancestry", LSSDDocumentStyles.SectionTitle));

            if (FNInfo != null)
            {
                if (FNInfo.IsDeclaringFirstNationsInfo)
                {
                    sectionParts.Add(
                        TableHelper.StyledTable(
                            TableHelper.StickyTableRow(
                                TableHelper.LabelCell("Aboriginal group:"),
                                TableHelper.ValueCell(FNInfo.AboriginalStatus),
                                TableHelper.LabelCell("Status Number:"),
                                TableHelper.ValueCell(FNInfo.StatusNumber)
                                ),
                            TableHelper.StickyTableRow(
                                TableHelper.LabelCell("Resides On Reserve:"),
                                TableHelper.ValueCell(FNInfo.ResidesOnReserve),
                                TableHelper.LabelCell("Reserve of Residence:"),
                                TableHelper.ValueCell(FNInfo.ReserveName)
                                ),
                            TableHelper.StickyTableRow(
                                TableHelper.LabelCell("Band Name:"),
                                TableHelper.ValueCell(FNInfo.BandName),
                                TableHelper.LabelCell("Reserve House:"),
                                TableHelper.ValueCell(FNInfo.ReserveHouse)
                                )
                            )
                        );
                }
                else
                {
                    sectionParts.Add(ParagraphHelper.Paragraph("No First Nations information was declared.", LSSDDocumentStyles.NormalParagraph));
                }
            }
            else
            {
                sectionParts.Add(ParagraphHelper.Paragraph("No First Nations data was collected.", LSSDDocumentStyles.NormalParagraph));
            }

            sectionParts.Add(ParagraphHelper.WhiteSpace());

            return(sectionParts);
        }
コード例 #28
0
        //OFFER
        /// <summary>
        /// Affect CPAOffer ONLY. Doesn't affect CPAOfferOnHold AT ALL!!
        /// </summary>
        /// <param name="ThisOffer"></param>
        public static void AddOfferToSync(CPAOfferOnHold ThisOffer)
        {
            //Wasnt synced, now need to ADD to sync
            //Check if not already in CPAOffers but deactivated (Status = rejected, issync = false)
            var where = TableHelper.MakeDictionary("NetworkOfferIdInt", ThisOffer.NetworkOfferId);
            where.Add("NetworkName", ThisOffer.NetworkName);

            var PreviousOffers = TableHelper.SelectRows <CPAOffer>(where);

            if (PreviousOffers.Count > 0)
            {
                //It already exists, activate it
                CPAOffer OfferToActivate = PreviousOffers[0];
                OfferToActivate.Status            = AdvertStatus.Active;
                OfferToActivate.IsSyncWithNetwork = true;
                OfferToActivate.Save();
            }
            else
            {
                //We need to add it
                CPAOffer NewOffer = new CPAOffer();
                NewOffer.IsFromAutomaticNetwork = ThisOffer.IsFromAutomaticNetwork;
                NewOffer.NetworkOfferId         = ThisOffer.NetworkOfferId;
                NewOffer.Title              = ThisOffer.Title;
                NewOffer.ImageURL           = ThisOffer.ImageURL;
                NewOffer.TargetURL          = ThisOffer.TargetURL;
                NewOffer.DateAdded          = DateTime.Now;
                NewOffer.Status             = AdvertStatus.Active;
                NewOffer.AdvertiserUsername = ThisOffer.AdvertiserUsername;
                NewOffer.LoginBoxRequired   = ThisOffer.LoginBoxRequired;
                NewOffer.EmailBoxRequired   = ThisOffer.EmailBoxRequired;
                NewOffer.LastCredited       = OffersManager.DateTimeZero;
                NewOffer.Description        = ThisOffer.Description;
                NewOffer.Category           = ThisOffer.Category;
                NewOffer.BaseValue          = ThisOffer.BaseValue;
                NewOffer.CreditsBought      = ThisOffer.CreditsBought; //Infinity
                NewOffer.NetworkName        = ThisOffer.NetworkName;
                NewOffer.NetworkRate        = ThisOffer.NetworkRate;
                NewOffer.IsSyncWithNetwork  = ThisOffer.IsSyncWithNetwork; // by default
                NewOffer.IsDaily            = ThisOffer.IsDaily;
                NewOffer.MaxDailyCredits    = ThisOffer.MaxDailyCredits;
                NewOffer.CopyGeolocation(ThisOffer);
                NewOffer.CreditOfferAs      = ThisOffer.CreditOfferAs;
                NewOffer.RequiredMembership = Membership.Standard.Id;
                NewOffer.Save();
            }
        }
コード例 #29
0
 /// <summary>
 /// 获取产品BOM信息
 /// </summary>
 private void Select()
 {
     try
     {
         string sql    = " 1=1 ";
         string method = context.Request.Params["method"].ToString();
         if (method == "model")
         {
             string MaterialCode = context.Request.Params["MaterialCode"].ToString();
             if (!string.IsNullOrEmpty(MaterialCode))
             {
                 sql += string.Format(" AND MaterialCode = {0}", MaterialCode);
             }
             MaterialFieldMDL model = DataDAL.GetModel(sql);
             if (model != null)
             {
                 ReturnData.Code = "1";
                 ReturnData.Msg  = "OK";
                 ReturnData.Data = model;
             }
         }
         else if (method == "search")
         {
             string MaterialCodeList = context.Request.Params["MaterialCodeList"].ToString();
             if (!string.IsNullOrEmpty(MaterialCodeList))
             {
                 sql += string.Format(" AND MaterialCode in ({0})", MaterialCodeList);
             }
             DataSet set = DataDAL.GetList(sql);
             if (set != null && set.Tables.Count > 0)
             {
                 DataTable table = set.Tables[0];
                 if (table != null && table.Rows.Count > 0)
                 {
                     object obj = TableHelper.TableToObj(table);
                     ReturnData.Code = "1";
                     ReturnData.Msg  = "OK";
                     ReturnData.Data = obj;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         CLog.WriteErrLog(ex.Message);
     }
 }
コード例 #30
0
ファイル: AdPackManager.cs プロジェクト: dovanduy/titan
    public static int GetAdDisplayTime(AdPacksAdvert ad)
    {
        var cache = new AdminIdCache();

        if (ad.CreatorUserId == (int)cache.Get())
        {
            return(AppSettings.RevShare.AdPack.AdminsAdvertDisplayTime);
        }

        string query = string.Format(@"SELECT TOP 1 DisplayTime 
                                       FROM AdPacks                                      
                                       WHERE AdPacksAdvertId = {0}
                                       AND TotalClicks < ClicksBought
                                       ORDER BY PurchaseDate", ad.Id);

        return((int)TableHelper.SelectScalar(query));
    }
コード例 #31
0
        public static void SynchronizeAll(bool ThrowExceptions = false)
        {
            var where = TableHelper.MakeDictionary("AffiliateNetworkSoftwareTypeInt", (int)AffiliateNetworkSoftwareType.CPALead);
            where.Add("Status", (int)NetworkStatus.Active);
            var PerformaList = TableHelper.SelectRows <AffiliateNetwork>(where);

            if (PerformaList.Count == 0 && ThrowExceptions)
            {
                throw new MsgException("There are no Active networks to synchronize");
            }

            foreach (var elem in PerformaList)
            {
                var SN = new CPALeadSyncedNetwork(elem);
                SN.Synchronize();
            }
        }
コード例 #32
0
        /// <summary>
        /// Bans all users which match the security role
        /// </summary>
        /// <param name="Role"></param>
        /// <param name="Expression">Country name, IP address or username</param>
        public static void ActivateSecurityRole(SecurityRuleType Rule, string Expression)
        {
            List <Member> ToBeBanned = new List <Member>();

            var where = TableHelper.MakeDictionary("AccountStatusInt", (int)MemberStatus.Active);

            switch (Rule)
            {
            case SecurityRuleType.Country:
                where.Add(Member.Columns.Country, Expression);
                ToBeBanned = TableHelper.SelectRows <Member>(where);
                break;

            case SecurityRuleType.IP:
                where.Add(Member.Columns.LastUsedIP, Expression);
                ToBeBanned = TableHelper.SelectRows <Member>(where);

                where.Remove(Member.Columns.LastUsedIP);
                where.Add(Member.Columns.RegisteredWithIP, Expression);
                ToBeBanned.AddRange(TableHelper.SelectRows <Member>(where));
                break;

            case SecurityRuleType.Username:
                where.Add(Member.Columns.Username, Expression);
                ToBeBanned = TableHelper.SelectRows <Member>(where);
                break;

            case SecurityRuleType.IPRange:
                var list = TableHelper.SelectRows <Member>(where);
                foreach (var elem in list)
                {
                    if (IPExtensions.IsInRange(elem.LastUsedIP, Expression) ||
                        IPExtensions.IsInRange(elem.RegisteredWithIP, Expression))
                    {
                        ToBeBanned.Add(elem);
                    }
                }
                break;
            }

            foreach (var user in ToBeBanned)
            {
                user.BanBlacklist(Rule.ToString());
                user.SaveStatus();
            }
        }
コード例 #33
0
 public static IEnumerable <OpenXmlElement> GetSection(FormSubmitter submittedBy)
 {
     return(new List <OpenXmlElement>()
     {
         TableHelper.StyledTable(
             new TableRow(
                 TableHelper.LabelCell("Form Submitted By", JustificationValues.Left).WithWidth(47.5),
                 TableHelper.LabelCell("Contact Details", JustificationValues.Left).WithWidth(47.5)
                 ),
             new TableRow(
                 TableHelper.ValueCell($"{submittedBy.FirstName} {submittedBy.LastName}", JustificationValues.Left),
                 TableHelper.ValueCell(submittedBy.ContactDetails)
                 )
             ),
         ParagraphHelper.WhiteSpace()
     });
 }
コード例 #34
0
        public void ShouldBeReturnedTheTempTableCreationScript()
        {
            TableHelper
            .GenerateLocalTempTableScript <TableDummy>()
            .Should()
            .Be(
                @"CREATE TABLE #TABLE_DUMMY_TEMP
(
	 ID BIGINT NOT NULL,
	 DESCRIPTION NVARCHAR(MAX),
	 DATE DATETIME NOT NULL,
	 FLAG BIT NOT NULL,
	 MONEY DECIMAL(18,0) NOT NULL,
	 Status INT NOT NULL
)
");
        }
コード例 #35
0
ファイル: Apple.cs プロジェクト: colebank/BloodHound
    public GoogleLoader(TableHelper tc, BlobHelper bh)
    {
        m_TableHelper = tc;
        m_LogBlob = bh;
        m_TableHelper.CreateTable("ISBN");

        m_LogBlob.CreateContainer("log");
        CloudBlobContainer container = m_LogBlob.BlobClient.GetContainerReference("log");

        CloudBlob blob = container.GetBlobReference("AudibleLoader.Log");
        BlobStream bs = blob.OpenWrite();
        TextWriter tw = new StreamWriter(bs);
        tw.WriteLine("test");
        tw.Flush();
        //content = new UTF8Encoding().GetString(data);
        bs.Close();
        //BlobStream OpenWrite ()
    }
コード例 #36
0
ファイル: DataManagerTest.cs プロジェクト: colin-o/DataHelper
        public void Should_Dump_Table_Data_To_Separate_Scripts()
        {
            // Given that I have a database with more than one table and each contains some data
            DatabaseHelper db = new DatabaseHelper();
            db.CreateDatabase();
            TableHelper table1 = new TableHelper();
            table1.CreateTable("Person", t =>
            {
                t.column("ID", ColumnType.Integer, true, false, true);
                t.column("Name", ColumnType.String);
                t.column("Age", ColumnType.Integer);
            })
            .AddRow("Colin", 28)
            .AddRow("Katherine", 25);

            TableHelper table2 = new TableHelper();
            table2.CreateTable("Animal", t =>
            {
                t.column("ID", ColumnType.Integer, true, false, true);
                t.column("Name", ColumnType.String);
                t.column("Kind", ColumnType.String);
            })
            .AddRow("Tiny", "Cat")
            .AddRow("Mayzie", "Dog");

            // When I dump the data
            IDataManager dumper = new MsSqlDataManager();
            List<InsertionScript> scripts = dumper.DumpTables(Test.Settings.ServerName, Test.Settings.DatabaseName);

            // I should get a data insertion script for each table
            var personScript = scripts.Where(s => s.TableName == "Person").FirstOrDefault();
            var animalScript = scripts.Where(s => s.TableName == "Animal").FirstOrDefault();
            Assert.IsNotNull(personScript);
            Assert.IsNotNull(animalScript);
            // And the scripts should have INSERT statements
            StringAssert.Matches(personScript.Script, new Regex("INSERT.*Person.*'Colin'.*28"));
            StringAssert.Matches(animalScript.Script, new Regex("INSERT.*Animal.*'Tiny'.*'Cat'"));
        }
コード例 #37
0
        private static void InitializeTableHelper()
        {
            if (_tableHelperInstances == null)
                _tableHelperInstances =  new TableHelper<Instance>(GetSetting("TableInstanceName"), "MongoDbData");

            if (_tableHelperShardInfo == null)
                _tableHelperShardInfo = new TableHelper<ShardInfo>(GetSetting("TableShardInfoName"), "MongoDbData");
        }
コード例 #38
0
 // Get help session from Table storage
 public static HelpSessionDataType GetHelpSession(string sessionId , string rowkey = "")
 {
     var helper = new TableHelper(Settings.StorageAccountConnection, tablename);
     var entity = helper.GetEntity<HelpSessionDataType>(sessionId, rowkey );
     return entity;
 }
コード例 #39
0
        private static void LoadPeopleData(string connStr)
        {
            const string peopleXmlFile = "People.xml";

            string basePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../Repository");
            string fileName = Path.Combine(basePath, peopleXmlFile);
            var xdoc = XDocument.Load(fileName);

            DateTime startTime = DateTime.Now;
            int recordCount = 0, totalRecordCount = xdoc.Element("people").Elements("person").Count();
            LogMsg("Adding {0:n0} people records.", totalRecordCount);

            LogMsg("Opening database: {0}", connStr);
            using (var sqlConn = new SqlCeConnection(connStr))
            using (
                TableHelper peopleTable = new TableHelper("People"),
                postalTable = new TableHelper("Postal"),
                phoneTable = new TableHelper("Phone"),
                emailTable = new TableHelper("Email"))
            {
                sqlConn.Open();

                peopleTable.Open(sqlConn);
                postalTable.Open(sqlConn);
                phoneTable.Open(sqlConn);
                emailTable.Open(sqlConn);

                var peopleElements = xdoc.Element("people").Elements("person");
                foreach (var personElement in peopleElements)
                {
                    var person =
                        personElement
                            .Elements("name")
                            .Select(
                                name =>
                                new Person
                                    {
                                        Title = (string)name.Attribute("title"),
                                        FirstName = (string)name.Attribute("first"),
                                        MiddleName = (string)name.Attribute("middle"),
                                        LastName = (string)name.Attribute("last"),
                                        Suffix = (string)name.Attribute("suffix"),
                                    })
                            .Single();

                    person.PostalAddresses =
                        personElement
                            .Elements("address")
                            .Select(
                                addr =>
                                new PostalAddress
                                    {
                                        LineOne = (string)addr.Attribute("addr1"),
                                        LineTwo = (string)addr.Attribute("addr2"),
                                        City = (string)addr.Attribute("city"),
                                        StateProvince = (string)addr.Attribute("stateProv"),
                                        Country = (string)addr.Attribute("country"),
                                        PostalCode = (string)addr.Attribute("postal"),
                                    })
                            .ToList();

                    person.EmailAddresses =
                        personElement
                            .Elements("email")
                            .Select(
                                email =>
                                new EmailAddress
                                    {
                                        Address = (string)email.Attribute("addr"),
                                    })
                            .ToList();

                    person.PhoneNumbers =
                        personElement
                            .Elements("phone")
                            .Select(
                                phone =>
                                new PhoneNumber
                                    {
                                        Number = (string)phone.Attribute("num"),
                                        NumberType = (string)phone.Attribute("type"),
                                    })
                            .ToList();

                    peopleTable.Record.SetValue(1, person.Title);
                    peopleTable.Record.SetValue(2, person.FirstName);
                    peopleTable.Record.SetValue(3, person.MiddleName);
                    peopleTable.Record.SetValue(4, person.LastName);
                    peopleTable.Record.SetValue(5, person.Suffix);
                    person.PersonId = peopleTable.Insert();

                    foreach (var postal in person.PostalAddresses)
                    {
                        postal.PersonId = person.PersonId;
                        postalTable.Record.SetValue(1, postal.PersonId);
                        postalTable.Record.SetValue(2, postal.LineOne);
                        postalTable.Record.SetValue(3, postal.LineTwo);
                        postalTable.Record.SetValue(4, postal.City);
                        postalTable.Record.SetValue(5, postal.StateProvince);
                        postalTable.Record.SetValue(6, postal.Country);
                        postalTable.Record.SetValue(7, postal.PostalCode);
                        postal.PostalAddressId = postalTable.Insert();
                    }

                    foreach (var phone in person.PhoneNumbers)
                    {
                        phone.PersonId = person.PersonId;
                        phoneTable.Record.SetValue(1, phone.PersonId);
                        phoneTable.Record.SetValue(2, phone.Number);
                        phoneTable.Record.SetValue(3, phone.NumberType);
                        phone.PhoneNumberId = phoneTable.Insert();
                    }

                    foreach (var email in person.EmailAddresses)
                    {
                        email.PersonId = person.PersonId;
                        emailTable.Record.SetValue(1, email.PersonId);
                        emailTable.Record.SetValue(2, email.Address);
                        email.EmailAddressId = emailTable.Insert();
                    }

                    if (++recordCount % 100 == 0)
                    {
                        LogMsg("Added {0:n0} records ({1}%)", recordCount, recordCount * 100 / totalRecordCount);
                    }
                }
            }

            LogMsg("Finished, added {0:n0} people records.", recordCount);
            LogMsg("Time: {0} ({1:n2} recs/sec)",
                DateTime.Now.Subtract(startTime),
                recordCount / DateTime.Now.Subtract(startTime).TotalSeconds);
        }
コード例 #40
0
        // Perform table storage operations.
        private static void TestTableStorage()
        {
            string storageConnectionString = ConfigurationManager.ConnectionStrings["Storage"].ConnectionString;
            TableHelper TableHelper = new TableHelper(storageConnectionString);

            try
            {
                Separator();

                List<CloudTable> tables;

                Console.Write("List tables ");
                if (TableHelper.ListTables(out tables))
                {
                    Console.WriteLine("true");
                    if (tables != null)
                    {
                        foreach (CloudTable tableName in tables)
                        {
                            Console.Write(tableName.Name + " ");
                        }
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Create table ");
                if (TableHelper.CreateTable("sampletable"))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Insert entity ");
                if (TableHelper.InsertEntity("sampletable",
                    new Contact("USA", "Pallmann") { LastName = "Pallmann", FirstName = "David", Email = "*****@*****.**", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Insert entity ");
                if (TableHelper.InsertEntity("sampletable",
                    new Contact("USA", "Smith") { LastName = "Smith", FirstName = "John", Email = "*****@*****.**", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Insert entity ");
                if (TableHelper.InsertEntity("sampletable",
                    new Contact("USA", "Jones") { LastName = "Jones", FirstName = "Tom", Email = "*****@*****.**", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Insert entity ");
                if (TableHelper.InsertEntity("sampletable",
                    new Contact("USA", "Peters") { LastName = "Peters", FirstName = "Sally", Email = "*****@*****.**", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Update entity ");
                if (TableHelper.ReplaceUpdateEntity("sampletable", "USA", "Pallmann",
                    new Contact("USA", "Pallmann") { LastName = "Pallmann", FirstName = "David", Email = "*****@*****.**", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Replace Update entity ");
                if (TableHelper.ReplaceUpdateEntity("sampletable", "USA", "Peters",
                    new Contact("USA", "Peters") { LastName = "Peters", FirstName = "Sally", Country = "USA" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Merge Update entity ");
                if (TableHelper.MergeUpdateEntity("sampletable", "USA", "Peters",
                    new MiniContact("USA", "Peters") { LastName = "Peters", FirstName = "Sally", Email = "*****@*****.**" }))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Contact contact = null;

                Console.Write("Get entity ");
                if (TableHelper.GetEntity<Contact>("sampletable", "USA", "Pallmann", out contact))
                {
                    Console.WriteLine("true");

                    if (contact != null)
                    {
                        Console.WriteLine("Contact.LastName: " + contact.LastName);
                        Console.WriteLine("Contact.FirstName: " + contact.FirstName);
                        Console.WriteLine("Contact.Email: " + contact.Email);
                        Console.WriteLine("Contact.Phone: " + contact.Phone);
                        Console.WriteLine("Contact.Country: " + contact.Country);
                    }
                    else
                    {
                        Console.WriteLine("Contact <NULL>");
                    }
                }
                else
                {
                    Console.WriteLine("false");
                }

                Separator();

                Console.Write("Query entities ");
                TableServiceContext tableServiceContext = new TableServiceContext(TableHelper.TableClient);
                IEnumerable<Contact> entities = TableHelper.QueryEntities<Contact>("sampletable").Where(e => e.PartitionKey == "USA").AsTableServiceQuery<Contact>(tableServiceContext);
                if (entities != null)
                {
                    Console.WriteLine("true");
                    foreach (Contact contact1 in entities)
                    {
                        Console.WriteLine("Contact.LastName: " + contact1.LastName);
                        Console.WriteLine("Contact.FirstName: " + contact1.FirstName);
                        Console.WriteLine("Contact.Email: " + contact1.Email);
                        Console.WriteLine("Contact.Phone: " + contact1.Phone);
                        Console.WriteLine("Contact.Country: " + contact1.Country);
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("<NULL>");
                }

                //Console.Write("Query entities ");
                //var query = (
                //    from Contact c
                //    in TableHelper.QueryEntities<Contact>("sampletable")
                //    where c.PartitionKey == "USA"
                //    select c
                //    ).AsTableServiceQuery<Contact>();
                //IEnumerable<Contact> entities = query.ToList();
                //if (entities != null)
                //{
                //    Console.WriteLine("true");
                //    foreach (Contact contact1 in entities)
                //    {
                //        Console.WriteLine("Contact.LastName: " + contact1.LastName);
                //        Console.WriteLine("Contact.FirstName: " + contact1.FirstName);
                //        Console.WriteLine("Contact.Email: " + contact1.Email);
                //        Console.WriteLine("Contact.Phone: " + contact1.Phone);
                //        Console.WriteLine("Contact.Country: " + contact1.Country);
                //        Console.WriteLine();
                //    }
                //}
                //else
                //{
                //    Console.WriteLine("<NULL>");
                //}

                Separator();

                Console.Write("Delete entity ");
                if (TableHelper.DeleteEntity<Contact>("sampletable", "USA", "Smith"))
                {
                    Console.WriteLine("true");
                }
                else
                {
                    Console.WriteLine("false");
                }

                ////Separator();

                ////Console.Write("Delete table ");
                ////if (TableHelper.DeleteTable("sampletable"))
                ////{
                ////    Console.WriteLine("true");
                ////}
                ////else
                ////{
                ////    Console.WriteLine("false");
                ////}
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION " + ex.ToString());
            }
        }