protected void ReportCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(0);

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int      userID = (int)Session["userID"];
            UsersBLL users  = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID         = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, e.Day.Date, e.Day.Date);
                directReportTasks.Merge(task);
            }
        }
        else
        {
            directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), e.Day.Date, e.Day.Date);
        }

        // If the month is CurrentMonth
        if (!e.Day.IsOtherMonth)
        {
            foreach (DataRow dr in directReportTasks)
            {
                if ((dr["Date"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = (DateTime)dr["Date"];

                    if (dtEvent.Equals(e.Day.Date))
                    {
                        System.Web.UI.WebControls.Image image;
                        image          = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = "images/green_diamond.gif";
                        e.Cell.Controls.Add(image);
                    }
                }
                //just want the first row...THIS IS VERY UGLY!
                return;
            }
        }
        //If the month is not CurrentMonth then hide the Dates
        else
        {
            e.Cell.Text = "";
        }
    }
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        Decimal TotalTime = 0;

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int      userID = (int)Session["userID"];
            UsersBLL users  = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(0, start, end);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID         = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, start, end);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, start, end);
            }

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "Your employees have worked ";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "The employee has worked ";
        }

        if (start == end)
        {
            Output.Text += TotalTime + " hrs on " + start.ToShortDateString();
        }
        else
        {
            Output.Text += TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();
        }
    }
示例#3
0
    protected void ReportCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange((int)Session["userID"], e.Day.Date, e.Day.Date);

        // If the month is CurrentMonth
        if (!e.Day.IsOtherMonth)
        {
            foreach (DataRow dr in task)
            {
                if ((dr["Date"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = (DateTime)dr["Date"];
                    if (dtEvent.Equals(e.Day.Date))
                    {
                        System.Web.UI.WebControls.Image image;
                        image          = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = "images/green_diamond.gif";
                        e.Cell.Controls.Add(image);
                    }
                }
                //just want the first row...THIS IS VERY UGLY!
                return;
            }
        }
        //If the month is not CurrentMonth then hide the Dates
        else
        {
            e.Cell.Text = "";
        }
    }
示例#4
0
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        TasksBLL tasks = new TasksBLL();
        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange((int)Session["userID"], start, end);

        decimal TotalTime = tasks.TotalTimeByUserIDByDateRange((int)Session["userID"], start, end);

        ByUserGridView.DataSource = task;
        ByUserGridView.DataBind();

        if (start == end)
            Output.Text = "You worked " + TotalTime + " hrs on " + start.ToShortDateString();
        else
            Output.Text = "You worked " + TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();

        MainMultiView.ActiveViewIndex = 0;
    }
示例#5
0
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange((int)Session["userID"], start, end);

        decimal TotalTime = tasks.TotalTimeByUserIDByDateRange((int)Session["userID"], start, end);

        ByUserGridView.DataSource = task;
        ByUserGridView.DataBind();

        if (start == end)
        {
            Output.Text = "You worked " + TotalTime + " hrs on " + start.ToShortDateString();
        }
        else
        {
            Output.Text = "You worked " + TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();
        }

        MainMultiView.ActiveViewIndex = 0;
    }
示例#6
0
    protected void ReportCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        TasksBLL tasks = new TasksBLL();
        TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(0);

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int userID = (int)Session["userID"];
            UsersBLL users = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, e.Day.Date, e.Day.Date);
                directReportTasks.Merge(task);
            }
        }
        else
        {
            directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), e.Day.Date, e.Day.Date);
        }

        // If the month is CurrentMonth
        if (!e.Day.IsOtherMonth)
        {
            foreach (DataRow dr in directReportTasks)
            {

                if ((dr["Date"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = (DateTime)dr["Date"];

                    if (dtEvent.Equals(e.Day.Date))
                    {
                        System.Web.UI.WebControls.Image image;
                        image = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = "images/green_diamond.gif";
                        e.Cell.Controls.Add(image);
                    }
                }
                //just want the first row...THIS IS VERY UGLY!
                return;
            }
        }
        //If the month is not CurrentMonth then hide the Dates
        else
        {
            e.Cell.Text = "";
        }
    }
示例#7
0
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        Decimal TotalTime = 0;

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int userID = (int)Session["userID"];
            UsersBLL users = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(0, start, end);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, start, end);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, start, end);
            }

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "Your employees have worked ";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "The employee has worked ";
        }

        if (start == end)
            Output.Text += TotalTime + " hrs on " + start.ToShortDateString();
        else
            Output.Text += TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();
    }
示例#8
0
    protected void ReportCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        TasksBLL tasks = new TasksBLL();
        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange((int)Session["userID"], e.Day.Date, e.Day.Date);

        // If the month is CurrentMonth
        if (!e.Day.IsOtherMonth)
        {
            foreach (DataRow dr in task)
            {
                if ((dr["Date"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = (DateTime)dr["Date"];
                    if (dtEvent.Equals(e.Day.Date))
                    {
                        System.Web.UI.WebControls.Image image;
                        image = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = "images/green_diamond.gif";
                        e.Cell.Controls.Add(image);
                    }
                }
                //just want the first row...THIS IS VERY UGLY!
                return;
            }
        }
        //If the month is not CurrentMonth then hide the Dates
        else
        {
            e.Cell.Text = "";
        }
    }