Exemplo n.º 1
0
    protected void AllTasksLB_Click(object sender, EventArgs e)
    {
        Decimal TotalTime = 0;
        int userID = (int)Session["userID"];

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

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

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);

                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(directReportUserID);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, DateTime.Today.AddDays(-1000), DateTime.Today);
            }

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

            Output.Text = "Your employees have worked " + TotalTime + " hrs since using TimeKeeper.";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(Convert.ToInt32(DirectReportsDropDown.SelectedValue));

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), DateTime.Today.AddDays(-1000), DateTime.Today);

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

            Output.Text = "The employee has worked " + TotalTime + " hrs since using TimeKeeper.";
        }
    }
    protected void AllTasksLB_Click(object sender, EventArgs e)
    {
        Decimal TotalTime = 0;
        int     userID    = (int)Session["userID"];

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

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

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);

                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(directReportUserID);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, DateTime.Today.AddDays(-1000), DateTime.Today);
            }

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

            Output.Text = "Your employees have worked " + TotalTime + " hrs since using TimeKeeper.";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(Convert.ToInt32(DirectReportsDropDown.SelectedValue));

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), DateTime.Today.AddDays(-1000), DateTime.Today);

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

            Output.Text = "The employee has worked " + TotalTime + " hrs since using TimeKeeper.";
        }
    }
    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 = "";
        }
    }
Exemplo n.º 4
0
    protected void DirectReportsBulletedList_Click(object sender, BulletedListEventArgs e)
    {
        int userID = Convert.ToInt32(DirectReportsBulletedList.Items[e.Index].Value);

        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(userID);

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

        Output.Text = "All tasks for " + DirectReportsBulletedList.Items[e.Index].Text;
        MainMultiView.ActiveViewIndex = 0;
    }
Exemplo n.º 5
0
    protected void DirectReportsBulletedList_Click(object sender, BulletedListEventArgs e)
    {
        int userID = Convert.ToInt32(DirectReportsBulletedList.Items[e.Index].Value);

        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(userID);

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

        Output.Text = "All tasks for " + DirectReportsBulletedList.Items[e.Index].Text;
        MainMultiView.ActiveViewIndex = 0;
    }
Exemplo n.º 6
0
    protected void AllTasksLB_Click(object sender, EventArgs e)
    {
        int userID = (int)Session["userID"];

        TasksBLL tasks = new TasksBLL();
        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(userID);

        decimal TotalTime = tasks.TotalTimeByUserIDByDateRange(userID, DateTime.Today.AddDays(-1000), DateTime.Today);

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

        Output.Text = "You have worked " + TotalTime + " hrs since using TimeKeeper.";

        MainMultiView.ActiveViewIndex = 0;
    }
Exemplo n.º 7
0
    protected void AllTasksLB_Click(object sender, EventArgs e)
    {
        int userID = (int)Session["userID"];

        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(userID);

        decimal TotalTime = tasks.TotalTimeByUserIDByDateRange(userID, DateTime.Today.AddDays(-1000), DateTime.Today);

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

        Output.Text = "You have worked " + TotalTime + " hrs since using TimeKeeper.";

        MainMultiView.ActiveViewIndex = 0;
    }
Exemplo n.º 8
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 = "";
        }
    }