Esempio n. 1
0
    public static ActionCount[] GetData(DateTime start, DateTime end)
    {
        List <ActionCount> result = new List <ActionCount>();

        SqlCommand commandCreated = new SqlCommand(@"SELECT CONVERT(VARCHAR,dt.dtime,1) AS 'Date', COUNT(a.DateCreated) AS 'ActionsAdded'
                        FROM dbo.udfDateTimes(@StartDate,@EndDate,1,'day') AS dt
                        LEFT JOIN (SELECT a.DateCreated, u.OrganizationID FROM Actions a INNER JOIN Users u ON a.CreatorID = u.UserID) a ON CAST(FLOOR(CAST(dt.dtime AS FLOAT)) AS DATETIME) = CAST(FLOOR(CAST(a.DateCreated AS FLOAT)) AS DATETIME) AND a.OrganizationID = @organizationID
                        GROUP BY dt.dtime
                        ORDER BY dt.dtime");

        commandCreated.Parameters.AddWithValue("@organizationid", UserSession.LoginUser.OrganizationID);
        commandCreated.Parameters.AddWithValue("@StartDate", start);
        commandCreated.Parameters.AddWithValue("@EndDate", end);

        DataTable actionsAdded = SqlExecutor.ExecuteQuery(UserSession.LoginUser, commandCreated);

        foreach (DataRow thisRow in actionsAdded.Rows)
        {
            ActionCount counts = new ActionCount();
            counts.ActionDate = (string)thisRow["Date"];
            counts.Count      = (int)thisRow["ActionsAdded"];
            result.Add(counts);
        }

        return(result.ToArray());
    }
Esempio n. 2
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     lock (sync)
     {
         ActionCount?.Invoke(actionCount);
         actionCount = 0;
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ActionCount != 0)
            {
                hash ^= ActionCount.GetHashCode();
            }
            if (AnotherActionCount != 0)
            {
                hash ^= AnotherActionCount.GetHashCode();
            }
            if (ServerId.Length != 0)
            {
                hash ^= ServerId.GetHashCode();
            }
            return(hash);
        }