So I have a UWP project that I handle bookings on a group of rooms in.
I get all of my values from a Json API.
I want to make like a loop that checks if a room is booked or not every minute or something like that, but I have no idé how to do it.
This is how I get all the rooms with the bookings and all the attributes to them:
public async void addroom()
{
string url = "https://api.booking.com/api/company/07ce8f7c-f3d3-4df2-84bd-33f8fc263deb/rooms";
HttpClient client = new HttpClient();
string response = await client.GetStringAsync(url);
List<Class2> data = JsonConvert.DeserializeObject<List<Class2>>(response);
foreach (Class2 room in data)
{
string booking = $"https://api.booking.com/api/company/07ce8f7c-f3d3-4df2-84bd-33f8fc263deb/rooms/{room.id}/bookings";
HttpClient BookingClient = new HttpClient();
string BookingResponse = await BookingClient.GetStringAsync(booking);
List<Bookings> bookings = JsonConvert.DeserializeObject<List<Bookings>>(BookingResponse);
room.Bookings = bookings;
string id = room.id;
string name = room.name;
int seats = room.seats;
Uri Img = room.ImageUrl;
List<Roomattribute> roomattrib = room.roomAttributes;
var NewRoom = new Room
{
RoomID = id,
RoomName = name,
FrontImage = Img,
Seats = seats,
};
foreach (var books in bookings)
{
string note = books.note;
DateTime TimeFrom = books.timeFrom;
DateTime TimeTo = books.timeTo;
Class2 BookRoom = books.room;
string BookId = books.id;
DateTime Now = new DateTime(2018, 04, 25, 09, 40, 00);
var BeforeEnd = books.timeTo.Subtract(Now).Subtract(TimeSpan.FromMinutes(15));
var BeforeBegin = books.timeFrom.Subtract(Now).Subtract(TimeSpan.FromMinutes(15));
if (books.timeFrom <= Now && books.timeTo > Now)
{
ToRed();
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = BeforeEnd;
ColorTimer.Tick += (sender, args) =>
{
ToYellow();
ColorTimer.Stop();
};
ColorTimer.Start();
}
else if (books.timeTo == Now)
{
ToGreen();
}
else
{
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = BeforeBegin;
ColorTimer.Tick += (sender, args) =>
{
ToYellow();
ColorTimer.Stop();
};
ColorTimer.Start();
}
}
foreach (var attri in roomattrib)
{
int attriId = attri.id;
string attriName = attri.name;
int attriIcon = attri.icon;
if (room.roomAttributes.Any(a => a.id == 1))
{
NewRoom.Tv = Visibility.Visible;
}
else if (room.roomAttributes.Any(a => a.id != 1))
{
NewRoom.Tv = Visibility.Collapsed;
}
if (room.roomAttributes.Any(a => a.id == 2))
{
NewRoom.Wifi = Visibility.Visible;
}
else if (room.roomAttributes.Any(a => a.id != 2))
{
NewRoom.Wifi = Visibility.Collapsed;
}
if (room.roomAttributes.Any(a => a.id == 3))
{
NewRoom.Projector = Visibility.Visible;
}
else if (room.roomAttributes.Any(a => a.id != 3))
{
NewRoom.Projector = Visibility.Collapsed;
}
if (room.roomAttributes.Any(a => a.id == 4))
{
NewRoom.Wboard = Visibility.Visible;
}
else if (room.roomAttributes.Any(a => a.id != 4))
{
NewRoom.Wboard = Visibility.Collapsed;
}
}
Rooms.Add(NewRoom);
}
}
Right now all of my code is working perfectly (Apart from that the all bookings goes to all of the rooms but that is off topic...) and when a room is unoccupied it has a green LinearGredientBrush and when a room gets booked it is changing color to red and when it is 15 min until the room is unoccupied the color is changing to yellow.
What I need the check for is for example if a room is canceled before the time runs out.
I was thinking that put all of this in a For loop could be a solution:
var BeforeEnd = books.timeTo.Subtract(Now).Subtract(TimeSpan.FromMinutes(15));
var BeforeBegin = books.timeFrom.Subtract(Now).Subtract(TimeSpan.FromMinutes(15));
if (books.timeFrom <= Now && books.timeTo > Now)
{
ToRed();
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = BeforeEnd;
ColorTimer.Tick += (sender, args) =>
{
ToYellow();
ColorTimer.Stop();
};
ColorTimer.Start();
}
else if (books.timeTo == Now)
{
ToGreen();
}
else
{
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = BeforeBegin;
ColorTimer.Tick += (sender, args) =>
{
ToYellow();
ColorTimer.Stop();
};
ColorTimer.Start();
}
I hope I described the question well enough, and would be very pleased to get some help with my question.
Thanks in advance!
Instead of creating a DispatcherTimer for each booking separately, you could just create a single one that is triggered once per a time interval, for example once per minute (depending on how often you want to see the color changes).
In the Tick handler, you could then just check for each room:
A booking is active: Red - this check can be done by a simple foreach loop over the bookings on the given room
A booking is starting in less than 15 minutes: Yellow - again a simple foreach loop, check the start times of all bookings, if one is less than 15 minutes away, we have a match
Otherwise: Green
The DispatcherTimer.Tick event fires after the time specified in Interval has elapsed. Tick continues firing at the same Interval until the Stop method is called, the app terminates, or the app is suspended (fires Suspending). So you can put the loop here and specify the internal is one minute.
Besides, if you want your app can run while minimized or under the lock screen, you can use extended execution to achieve it. See the topic Postpone app suspension with extended execution.
---Update---
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
//Get current managed thread ID
Debug.WriteLine(Environment.CurrentManagedThreadId);
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMinutes(1);
timer.Tick += async (ob, arg) =>
{
Debug.WriteLine(Environment.CurrentManagedThreadId);
//You can update the booking room color here
//TODO get data and update room color
//You can also update the booking room color using Dispatcher.RunAsync method.
//This is alternative to update the data on the Tick event above TODO part directly .
//await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
//{
// Debug.WriteLine(Environment.CurrentManagedThreadId);
// //TODO get data and update room color
//});
};
timer.Start();
}
You can see the CoreDispatcher.RunAsync(CoreDispatcherPriority, DispatchedHandler) Method.
Related
enter image description here
suppose A is my Table and inside this table i have one column like times
inside column name times i have n number of times
Example :-1st:-02:30
2nd:-03:25
3rd:-00:45
i want output like TotalTime=06:40
i got out put using jquery but i want how to do inside a controller using foreach loop please help me
my controller code:-
[HttpPost]
public ActionResult getTimeSheetByBasit(DateTime? CurrentDate, string ActivityTime)
//obj.UserDocumentList = ThidDb.UserDocument.Where(x => x.CreatedBy == UserId).ToList();
{
VM_TimeSheet ObjVM_TimeSheet = new VM_TimeSheet();
int LoggedUser = User.KEY();
string LoggedUserName = User.UserName();
string UserEmail = User.EmailID();
DateTime TimeIn, TimeOut;
string TimeInn, TimeOuut, TotalTime;
//code add here fot adding text box time with total houres enter by user select time Sheet
using (SecurenetDB SecurenetDB = new SecurenetDB())
{
ObjVM_TimeSheet.TimesheetList = SecurenetDB.AD_TimeSheet.Where(x => DbFunctions.TruncateTime(x.ActivityDate.Value) == DbFunctions.TruncateTime(CurrentDate) && x.UserKEY == LoggedUser).ToList();
TimeIn = SecurenetDB.AD_CardPunching.Where(x => DbFunctions.TruncateTime(x.EventDate) == DbFunctions.TruncateTime(CurrentDate) && x.UserName == LoggedUserName).Select(x => x.Time_In).FirstOrDefault();
TimeOut = SecurenetDB.AD_CardPunching.Where(x => DbFunctions.TruncateTime(x.EventDate) == DbFunctions.TruncateTime(CurrentDate) && x.UserName == LoggedUserName).Select(x => x.Time_Out).FirstOrDefault();
TimeInn = TimeIn.ToString("hh:mm tt");
TimeOuut = TimeOut.ToString("hh:mm tt");
TotalTime = SecurenetDB.AD_CardPunching.Where(x => DbFunctions.TruncateTime(x.EventDate) == DbFunctions.TruncateTime(CurrentDate) && x.UserName == LoggedUserName).Select(x => x.TotalHours).FirstOrDefault();
// ObjVM_TimeSheet.TimesheetList=SecurenetDB.AD_TimeSheet.Where(x=>x.Hours== TextTime && x.UserKEY == LoggedUser).ToList();
var sum = "00:00";
foreach(var iteam in ActivityTime)
{
sum = sum + iteam;
}
}
return Json(new
{
TimeSheetData = this.RenderPartialViewToString("TimeSheetData", ObjVM_TimeSheet.TimesheetList),
TimeIn = TimeInn,
TimeOut = TimeOuut,
TotalTime = TotalTime
}, JsonRequestBehavior.AllowGet);
}
enter image description here
Use TimeSpan
string[] times = new string[] {"02:30", "03:25", "00:45"};
TimeSpan totalTime = new TimeSpan(0);
foreach (string time in times)
{
TimeSpan ts = TimeSpan.Parse(time);
totalTime += ts;
}
Console.WriteLine(totalTime.ToString(#"hh\:mm"));
Output
06:40
I am creating a date time picker but for some reason my tap gesture is not showing the date picker am using for the date portion of the control.
public DateTimePicker2()
{
BindingContext = this;
_dayEntry.TextChanged += _dayEntry_TextChanged;
_dayEntry.Focused += _dayEntry_Focused;
_monthEntry.TextChanged += _monthEntry_TextChanged;
_yearEntry.TextChanged += _yearEntry_TextChanged;
Content = new StackLayout()
{
Orientation = StackOrientation.Horizontal,
Children =
{
_dayEntry,
_monthEntry,
_yearEntry,
_hourEntry,
_minsEntry,
_ampmPicker
}
};
The code is getting hit but just not presenting the datpicker I think my control might be hidding it some how.
_datePicker.SetBinding<DateTimePicker2>(DatePicker.DateProperty, p => p._date);
_timePicker.SetBinding<DateTimePicker2>(TimePicker.TimeProperty, p => p._time);
I am using the focus and unfocused events
_timePicker.Unfocused += (sender, args) => _time =
_timePicker.Time;
_datePicker.Focused += (s, a) => UpdateEntryText();
GestureRecognizers.Add(new TapGestureRecognizer()
{
Command = new Command(() => _datePicker.Focus())
});
When the user picks the _day entry textbox lets display the date popup for them.
Dayy entry is just a dynamic entry box.
public Entry _dayEntry { get; private set; } = new Entry() {
TabIndex=0,
Placeholder="Day" ,Keyboard=Keyboard.Numeric, WidthRequest = 60
,HorizontalOptions = LayoutOptions.Start };
Date time pickers are declared as such
public DatePicker _datePicker { get; private set; } = new
DatePicker() { MinimumDate = DateTime.Today, IsVisible = false };
public TimePicker _timePicker { get; private set; } = new
TimePicker() { IsVisible = false };
_dayEntry.Focused += (sender, args) =>
{
Device.BeginInvokeOnMainThread(() => _datePicker.Focus());
};
_datePicker.Unfocused += (sender, args) =>
{
Device.BeginInvokeOnMainThread(() =>
{
_timePicker.Focus();
_date = _datePicker.Date;
UpdateEntryText();
});
};
}
Even if I add isVisble it does not show.
_dayEntry.Focused += (sender, args) =>
{
Device.BeginInvokeOnMainThread(() => {
_datePicker.IsVisible = true;
_datePicker.Focus();
});
};
The problem was that the date time pickers where not added as children that is why their visiblity is set to false ;-)
Content = new StackLayout()
{
Orientation = StackOrientation.Horizontal,
Children =
{
_datePicker, ** Important these must exist **
_timePicker, ** Important these must exist **
_dayEntry,
_monthEntry,
_yearEntry,
_hourEntry,
_minsEntry,
_ampmPicker}
}
};
I create a chart based on data of a GridView, so if a user select a row in my grid view I execute the chart create as:
private void dgvUserActivity_CellClick(object sender, DataGridViewCellEventArgs e)
{
var dg = (DataGridView)sender;
if (e.RowIndex == -1) return;
var selectedrowindex = dg.SelectedCells[0].RowIndex;
var selectedRow = dg.Rows[selectedrowindex];
var selectedUserName = selectedRow.Cells["UserName"].Value.ToString();
UserActivityAuditModel = UserActivityModel.UserActivityAuditList.Where(x => x.UserName == selectedUserName).ToList();
ClearChartPoints();
userChart.Titles.Clear();
LoadChart(UserActivityAuditModel);
}
Then I load chart as:
private void LoadChart(IList<UserActivityAuditViewModel> model)
{
//Filter info
var selectedTime = new List<TimeSpan>();
if (rdoLogOn.Checked)
{
selectedTime = model.Select(x => x.AverageLogOn).ToList();
}
else if (rdoLogOff.Checked)
{
selectedTime = model.Select(x => x.AverageLogOff).ToList();
}
else
{
selectedTime = model.Select(x => x.AverageTotalHours).ToList();
}
Axis XA = userChart.ChartAreas[0].AxisX;
Axis YA = userChart.ChartAreas[0].AxisY;
Series S1 = userChart.Series[0];
S1.ChartType = SeriesChartType.Line;
//Add or change Title
var title = new Title();
title.Font = new Font("Arial", 14, FontStyle.Bold);
title.Text = Helpers.FirstCharToUpper(model.Select(x => x.UserName).FirstOrDefault());
userChart.Titles.Add(title);
var dates = model.Select(x => x.ActivityDate).ToList();
var currentRegister = 0;
foreach (DateTime d in dates)
{
var yValue = selectedTime[currentRegister].ToString();
S1.Points.AddXY(d, yValue);
currentRegister++;
}
var dt = DateTime.Now;
S1.LegendText = "Year " + dt.Year;
// move to the bottom center:
userChart.Legends[0].Docking = Docking.Bottom;
userChart.Legends[0].Alignment = StringAlignment.Center;
if (!rdoTotalHours.Checked)
{
S1.YValueType = ChartValueType.Time;
XA.LabelStyle.Format = "mm:ss";
}
else
{
}
S1.XValueType = ChartValueType.Date;
XA.MajorGrid.Enabled = false;
XA.LabelStyle.Format = "MMM";
XA.IntervalType = DateTimeIntervalType.Months;
XA.Interval = 1;
YA.IsInterlaced = true;
//YA.MajorGrid.Enabled = false;
YA.InterlacedColor = Color.FromArgb(31, Color.LightSeaGreen);
}
For some reason in my first clic of DataGridView it executes the chart create,I debug it and the problem is in this foreach clause :
foreach (DateTime d in dates)
{
var yValue = selectedTime[currentRegister].ToString();
S1.Points.AddXY(d, yValue);
currentRegister++;
}
The value is there, after S1.Points.AddXY(d, yValue); is executed, I debug Points Y value is always 0 but the yValue I set has the correct number!. This is really weird.
Pictures:
As you can see value is there, but when I press F10 to continue debugging:
It added as 0 instead my value
Note: As I say before, this is only first time load, if I clic again in any row, it load correctly, someone have an idea of what is happening there? Regards
----EDIT----
I get the yValue from my global model:
public IList<UserActivityAuditViewModel> UserActivityAuditModel { get; set; } = new List<UserActivityAuditViewModel>();
Then I assign it depending of some radio buttons on the beginning of chart method:
var selectedTime = new List<TimeSpan>();
if (rdoLogOn.Checked)
{
selectedTime = model.Select(x => x.AverageLogOn).ToList();
}
else if (rdoLogOff.Checked)
{
selectedTime = model.Select(x => x.AverageLogOff).ToList();
}
else
{
selectedTime = model.Select(x => x.AverageTotalHours).ToList();
}
and I use that TimeSpan list into yValue
I create a simple test, instead load my Y value with TimeSpan I create an int list as:
var testList = new List<int>();
testList.Add(1);
testList.Add(2);
testList.Add(3);
testList.Add(4);
testList.Add(5);
testList.Add(6);
testList.Add(7);
testList.Add(8);
testList.Add(9);
testList.Add(10);
testList.Add(11);
testList.Add(12);
testList.Add(13);
Then I use in foreach as
foreach (DateTime d in dates)
{
var yValue = testList[currentRegister].ToString();
S1.Points.AddXY(d, yValue);
currentRegister++;
}
And now chart load in first load, but I can not understand why is not working with TimeSpan in first load, can someone have an idea of what is happening and a solution for this?
I found the issue
Charts does not support TimeSpan, so for some reason at the first render of chart it conflicts with Chart data. So the simplest solution I found is to convert TimeSpan to DateTime, at the end of the day we use YValueType as Time so it will take the time of the DateTime and display instead Date:
foreach (DateTime d in dates)
{
var datetime = new DateTime(0).AddSeconds(selectedTime[currentRegister].TotalSeconds);
S1.Points.AddXY(d, datetime);
currentRegister++;
}
I want to schedule tasks with the Microsoft Solver Framework. For now i have the simple goal to just order the tasks in a queue so that i get a minimal project time. (later i want to have more than one queue). I tried to approach this with the following setup:
Decision:
projectFinish
start
finish
Parameter:
duration
Constraint:
start + duration = finish
not more than one task at a time
projectFinish after all tasks finished
Goal:
minimize projectFinish
Here is my code so far
static void Main(string[] args) {
var data = new List<Task>() {
new Task(){ Duration = 1, Name = "task0"},
new Task(){ Duration = 1, Name = "task1"},
new Task(){ Duration = 1, Name = "task2"},
};
SolveScheduling(data);
}
public class Task {
private static int id_counter = 0;
public Task() { ID = id_counter++; }
public int ID { get; private set; }
public string Name { get; set; }
public double Duration { get; set; }
}
private static void SolveScheduling(IEnumerable<Task> data) {
SolverContext context = SolverContext.GetContext();
Model model = context.CreateModel();
var set = new Set(Domain.Any,"TaskSet");
var projectFinish = new Decision(Domain.IntegerNonnegative, "projectFinish");
model.AddDecision(projectFinish);
var taskSet = new Set(Domain.Any, "tasks");
var durations = new Parameter(Domain.RealNonnegative, "durations", taskSet);
durations.SetBinding(data, "Duration", "Name");
var ids = new Parameter(Domain.Integer, "ids", taskSet);
ids.SetBinding(data, "ID", "Name");
var starts = new Decision(Domain.RealNonnegative, "starts", taskSet);
var finishs = new Decision(Domain.RealNonnegative, "finishs", taskSet);
model.AddDecisions(starts, finishs);
model.AddParameters(durations, ids);
// Constraints
// start + duration = finish
model.AddConstraint("constraint0", Model.ForEach(taskSet, (t) => starts[t] + durations[t] == finishs[t]));
// Tasks after each other
model.AddConstraint("constraint1", Model.ForEach(taskSet, t =>
Model.ForEachWhere(taskSet, t2 => Model.Or(finishs[t] < starts[t2] , starts[t] > finishs[t2]), (t2) => ids[t] != ids[t2])));
// projectFinish after all tasks finished
model.AddConstraint("constraint2", Model.ForEach(taskSet, t => projectFinish >= finishs[t]));
// Goals
model.AddGoal("goal0", GoalKind.Minimize, projectFinish);
Solution solution = context.Solve();//new SimplexDirective());
Report report = solution.GetReport();
Console.WriteLine(#"===== report =====");
Console.Write("{0}", report);
Console.ReadLine();
}
Now the problem is that it takes for ever to solve this (although it are only 3 tasks and 1 queue). What am i missing here and how can i improve the speed of solving.
Update
I found a solution for my problem. If you have any improvements feel free to comment. Here is my code:
SolverContext context = SolverContext.GetContext();
Model model = context.CreateModel();
// === Sets ===
var taskSet = new Set(0,data.Count(), 1);
// === Parameters ===
var duration = new Parameter(Domain.RealNonnegative, "durations", taskSet);
var id = new Parameter(Domain.RealNonnegative, "id", taskSet);
duration.SetBinding(data, "Duration", "ID");
id.SetBinding(data, "ID", "ID");
model.AddParameters(duration, id);
// === Decisions ===
var projectFinish = new Decision(Domain.RealNonnegative, "projectFinish");
var start = new Decision(Domain.RealNonnegative, "starts", taskSet);
var finish = new Decision(Domain.RealNonnegative, "finishs", taskSet);
model.AddDecisions(projectFinish, start, finish);
// === Constraints ===
model.AddConstraint("constraint0", start[0] == 0);
// start + duration = finish
model.AddConstraint("constraint1", Model.ForEach(taskSet, (t) => start[t] + duration[t] == finish[t]));
// projectFinish after all tasks finished
model.AddConstraint("constraint2", Model.ForEach(taskSet, t => projectFinish >= finish[t]));
// not more than one task at a time
model.AddConstraint("constraint3", Model.ForEach(taskSet, t =>
Model.ForEachWhere(taskSet, t2 => Model.Or(finish[t] < start[t2], start[t] > finish[t2]), (t2) => id[t] != id[t2])));
// === Goals ===
model.AddGoal("goal0", GoalKind.Minimize, projectFinish); // minimieren der projekt zeit
// === Solve ===
context.CheckModel();
Solution solution = context.Solve();
I found a solution that works for me. I changed the taskSet
var taskSet = new Set(0, data.Count(), 1);
and added a new constraint
model.AddConstraint("constraint", starts[0] == 0);
I updated the question
i'm new in programming and i'm working on a Windows form application. I made a repostory class for all my dataBase work. I made a function in the repository that returns an IQueryable- it returns a key value pair.(key=dayOfWeek and value=revenue). Then when i called this function in the Form, because i wanted the information to be printed on labels, i cannot access the key seperately and the value seperately. It only gives me the option of the the whole key value pair.
this is my code in the repository class:
public class ReportsRepository
{
FruitStoreDataContext db;
public IQueryable RevenuePerDayOfWeek(DateTime startDate, DateTime endDate)
{
db = new FruitStoreDataContext();
var sumPerday = from s in db.OrderDetails
where s.Order.OrderDate >=startDate && s.Order.OrderDate <=endDate
select new
{
day = s.Order.OrderDate.DayOfWeek,
revenue = s.Price * s.Quantity
};
var totalSumPerday = from f in sumPerday
group f.revenue by f.day into g
select new
{
Day= g.Key,
Sum = g.Sum()
};
return totalSumPerday;
}
private void Report1Form_Load(object sender, EventArgs e)
{
ReportsRepository report = new ReportsRepository();
var totalSumPerday = report.RevenuePerDayOfWeek(dateToStart, dateToEnd);
int[]numOfDays = new int[7];
for (DateTime day = dateToStart; day <= dateToEnd; day = day.AddDays(1))
{
dayOfWeek = Convert.ToInt32(day.DayOfWeek);
numOfDays[dayOfWeek]++;
}
Label label;
List<Label> labels = new List<Label>();
int t = 0;
foreach(var totalSum in totalSumPerday)
{
if (numOfDays[dayOfWeek] == 0)
numOfDays[dayOfWeek] = 1;
int y = (38 * t) + 60;
label = new Label();
label.Location = new Point(34, y);
label.Visible = true;
label.Size = new Size(450, 35);
label.BackColor = Color.Gray;
label.ForeColor = Color.White;
label.Font = new Font("Lucida Console", 16);
dayOfWeek = Convert.ToInt16(totalSum.Day.Key);
//on the line below the word 'Day' and 'Sum' are underlined red...it doesn't give me the option to do that. I can only access the whole thing together(key,value)
label.Text = totalSum.Day.ToString() + " : " + (totalSum.Sum / numOfDays[dayOfWeek]).ToString();
labels.Add(label);
panel1.Controls.Add(label);
t++;
}
First, You can do one query to achieve your result. Second, you don't need to return IQueryable as you want in-memory data only (with not further querying). So what you can do is:
public Dictionary<int, decimal> RevenuePerDayOfWeek(DateTime startDate, DateTime endDate)
{
db = new FruitStoreDataContext();
var sumPerday = (from s in db.OrderDetails
where s.Order.OrderDate >= startDate && s.Order.OrderDate <= endDate
group s by s.Order.OrderDate.DayOfWeek into grp
select new
{
Day = grp.Key,
Sum = grp.Sum(a => a.Price * a.Quantity)
}).ToDictionary(x => x.Day, x => x.Sum);
return sumPerday;
}
Usage in Report1Form_Load:
var totalSumPerday = report.RevenuePerDayOfWeek(dateToStart, dateToEnd);
foreach (var totalSum in totalSumPerday)
{
DayOfWeek dayOfWeek = totalSum.Key;
decimal sum = totalSum.Value;
// continue your code
}