/// <summary> /// Sets the contents of the information bar which is above the task gridview. /// </summary> protected void SetInfoBar() { TasksBLL task = new TasksBLL(); decimal time = task.TotalTimeByUserIDByDate((int)Session["userID"], DateTime.Today); //The timebar is a graphical view of the total time worked today. It grows as you add tasks is based on a //percentage of the shift varible or number of work hours per day. //shift is a temp that holds the number of hours worked per day that needs to be moved into users table int shift = 8; //number of pixels in height the bar should be timebarIB.Height = 3; //if we have worked less than our shift time display the bar in black, otherwise display it in red if (shift - time >= 0) { timebarIB.Width = Unit.Percentage((double)time / shift * 100); timebarIB.ImageUrl = "images/black_dot.gif"; timebarIB.ToolTip = shift - time + " hrs left today!"; } else { timebarIB.Width = Unit.Percentage(100); timebarIB.ImageUrl = "images/red_dot.gif"; timebarIB.ToolTip = "You have worked " + (time - shift) + " extra hours today so far"; } }
protected void YesterdayLB_Click(object sender, EventArgs e) { TasksBLL task = new TasksBLL(); decimal time = task.TotalTimeByUserIDByDate((int)Session["userID"], DateTime.Today.AddDays(-1)); TasksDataSource.SelectParameters.Clear(); TasksDataSource.SelectMethod = "GetTasksByUserIDByDate"; TasksDataSource.SelectParameters.Add(new Parameter("userID", TypeCode.String, Session["userID"].ToString())); TasksDataSource.SelectParameters.Add(new Parameter("date", TypeCode.DateTime, DateTime.Now.AddDays(-1).ToShortDateString())); StatsLabel.Text = "You worked " + time + " hrs yesterday"; ViewHelper("Yesterday"); }
protected void TodayLB_Click(object sender, EventArgs e) { TasksBLL task = new TasksBLL(); decimal time = task.TotalTimeByUserIDByDate((int)Session["userID"], DateTime.Today);; decimal prjtime = task.WeeklyProjectTimeByUserID((int)Session["userID"]); TasksDataSource.SelectParameters.Clear(); TasksDataSource.SelectMethod = "GetTasksByUserIDByDate"; TasksDataSource.SelectParameters.Add(new Parameter("userID", TypeCode.String, Session["userID"].ToString())); TasksDataSource.SelectParameters.Add(new Parameter("date", TypeCode.DateTime, DateTime.Now.ToShortDateString())); if (prjtime > 0) { StatsLabel.Text = "You have worked for " + time + " hours today and " + prjtime.ToString() + " project hours this week."; } else { StatsLabel.Text = "You have worked for " + time + " hours today."; } ViewHelper("Today"); }