public static SourceCount[] GetData(DateTime start, DateTime end) { List <SourceCount> result = new List <SourceCount>(); SqlCommand command = new SqlCommand(@"SELECT ISNULL(TicketSource,'Agent') AS 'TicketSource', COUNT(*) AS 'Number' FROM Tickets WHERE OrganizationID = @organizationID AND DateCreated > @StartDate AND DateCreated < DATEADD(DAY,1,@EndDate) GROUP BY ISNULL(TicketSource,'Agent')"); command.Parameters.AddWithValue("@organizationid", UserSession.LoginUser.OrganizationID); command.Parameters.AddWithValue("@StartDate", start); command.Parameters.AddWithValue("@EndDate", end); DataTable ticketSource = SqlExecutor.ExecuteQuery(UserSession.LoginUser, command); foreach (DataRow thisRow in ticketSource.Rows) { SourceCount counts = new SourceCount(); counts.Name = (string)thisRow["TicketSource"]; counts.Count = (int)thisRow["Number"]; result.Add(counts); } return(result.ToArray()); }
private void RefreshData() { if (Domain.Instance.SelectedStructureInfo.FilteredData != null) { DataBinding = Domain.Instance.SelectedStructureInfo.FilteredData.ToList(); } if (DataBinding.Count != 0) { LblAnzahle.Content = DataBinding.Count.ToString(); LblAnzahlProzent.Content = String.Format("{0:0.00}", Convert.ToDouble(LblAnzahle.Content) * 100 / SourceCount) + "%"; Testdatatype(DataBinding.ToArray()); FindMaximalZeichen(DataBinding.ToArray()); } else { LblAnzahle.Content = "0"; LblAnzahlProzent.Content = "0" + "%"; } LblGesamtAnzahl.Content = SourceCount.ToString(); }