Пример #1
0
        private StatusCount GetStatusInfo(string userName)
        {
            var parameters = new List <SqlParameter>
            {
                new SqlParameter("username", userName)
            };

            var query = @"
                SELECT  CurrentStatus AS [Status] ,
                        COUNT(*) AS [Tickets]
                FROM    dbo.Tickets
                WHERE   AssignedTo = @username
                GROUP BY CurrentStatus
            ";

            var statusCount = new StatusCount();

            var results = DoDatabaseQuery(query, parameters);

            while (results.Read())
            {
                if ((string)results["Status"] == "Active")
                {
                    statusCount.Active = (int)results["Tickets"];
                }
                if ((string)results["Status"] == "Closed")
                {
                    statusCount.Closed = (int)results["Tickets"];
                }
                if ((string)results["Status"] == "More Info")
                {
                    statusCount.MoreInfo = (int)results["Tickets"];
                }
                if ((string)results["Status"] == "Resolved")
                {
                    statusCount.Resolved = (int)results["Tickets"];
                }
            }
            results.Close();

            return(statusCount);
        }
Пример #2
0
        private string SerializeStatuses(StatusCount statuses)
        {
            var statusCountInfo = "Resolved tickets: " + statuses.Resolved + ", Active tickets: " + statuses.Active + ", Closed tickets: " + statuses.Closed + ", More info required: " + statuses.MoreInfo;

            return(statusCountInfo);
        }