コード例 #1
0
    public bool AddTask(DateTime date, decimal time, string workDone, string notes, string woNum, string rfcNum, int serviceID, int projectID, int userID, int phaseID, int assetID, int categoryID)
    {
        //Create a new TaskRow instance
        TimeKeeper.TasksDataTable Tasks = new TimeKeeper.TasksDataTable();
        TimeKeeper.TasksRow       task  = Tasks.NewTasksRow();

        task.Date       = date;
        task.Time       = time;
        task.WorkDone   = workDone;
        task.Notes      = notes;
        task.WONum      = woNum;
        task.RFCNum     = rfcNum;
        task.ServiceID  = serviceID;
        task.ProjectID  = projectID;
        task.UserID     = userID;
        task.PhaseID    = phaseID;
        task.AssetID    = assetID;
        task.CategoryID = categoryID;

        //Add the new task
        Tasks.AddTasksRow(task);
        int rowsAffected = Adaptor.Update(Tasks);

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }
コード例 #2
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 = "";
        }
    }
コード例 #3
0
    public bool UpdateTask(DateTime date, decimal time, string workDone, string notes, string woNum, string rfcNum, int serviceID, int projectID, int userID, int phaseID, int assetID, int categoryID, int taskID)
    {
        TimeKeeper.TasksDataTable tasks = Adaptor.GetTaskByTaskID(taskID);
        if (tasks.Count == 0)
        {
            return(false);
        }

        TimeKeeper.TasksRow task = tasks[0];

        task.Date       = date;
        task.Time       = time;
        task.WorkDone   = workDone;
        task.Notes      = notes;
        task.WONum      = woNum;
        task.RFCNum     = rfcNum;
        task.ServiceID  = serviceID;
        task.ProjectID  = projectID;
        task.UserID     = userID;
        task.PhaseID    = phaseID;
        task.AssetID    = assetID;
        task.CategoryID = categoryID;

        //Add the new task
        int rowsAffected = Adaptor.Update(task);

        //Return true if precisely one row was inserted, otherwise false
        return(rowsAffected == 1);
    }
コード例 #4
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 = "";
        }
    }
コード例 #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;
    }
コード例 #6
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();
        }
    }
コード例 #7
0
    protected void AllNonProjectsLB_Click(object sender, EventArgs e)
    {
        int projectID = -1;
        int userID    = (int)Session["userID"];

        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTasksByProjectIDByUserID(-1, userID);

        decimal NonProjectTime = tasks.TotalTimeByUserIDByProjectID(userID, projectID);

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

        Output.Text = "They have worked " + NonProjectTime + " hrs non-project time since using TimeKeeper.";
    }
コード例 #8
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;
    }
コード例 #9
0
    protected void PopulateForm(int taskID)
    {
        TasksBLL tasks = new TasksBLL();

        TimeKeeper.TasksDataTable task = tasks.GetTaskByTaskID(taskID);

        if (task[0].UserID.ToString() == Session["userID"].ToString())
        {
            //StatsLabel.Text = "Editing Task ID = " + taskID.ToString();
            StatsLabel.Text = "Edit/view your task below...";

            DateTextBox.SelectedDate = Convert.ToDateTime(task[0].Date);
            TimeTextBox.Text         = task[0].Time.ToString();
            WorkDoneTextBox.Text     = task[0].WorkDone;

            CategoryDropDown.SelectedValue = task[0].CategoryID.ToString();

            if (task[0].ProjectID > 0)
            {
                EnablePhase(true);
                EnableProject(true, true);
                ProjectDropDownList.SelectedValue = task[0].ProjectID.ToString();
                PhaseDropDown.SelectedValue       = task[0].PhaseID.ToString();
            }
            else
            {
                EnablePhase(false);
                EnableProject(true, false);
                ProjectDropDownList.SelectedValue = "None";
                PhaseDropDown.SelectedValue       = "None";
            }

            ServiceDropDownList.SelectedValue = task[0].ServiceID > 0 ? task[0].ServiceID.ToString() : "None";
            AssetDropDown.SelectedValue       = task[0].AssetID > 0 ? task[0].AssetID.ToString() : "None";

            WOTextBox.Text  = task[0].WONum;
            RFCTextBox.Text = task[0].RFCNum;
        }
        else
        {
            StatsLabel.Text = "Incorrect user!";
            Server.Transfer("Tasks.aspx");
        }
    }
コード例 #10
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.";
        }
    }
コード例 #11
0
    protected void ServicesDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ServicesDropDownList.SelectedValue != "None")
        {
            int serviceID = Convert.ToInt32(ServicesDropDownList.SelectedValue);
            int userID    = (int)Session["userID"];

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable task = tasks.GetTasksByServiceIDByUserID(serviceID, userID);

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

            Output.Text = "All your tasks for the " + ServicesDropDownList.SelectedItem.Text + " effort type.";
            MainMultiView.ActiveViewIndex = 2;
        }
        else
        {
            Server.Transfer("Reports.aspx");
        }
    }
コード例 #12
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;
    }
コード例 #13
0
    protected void ProjectsDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ProjectsDropDownList.SelectedValue != "None")
        {
            int projectID = Convert.ToInt32(ProjectsDropDownList.SelectedValue);
            int userID    = (int)Session["userID"];

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable task = tasks.GetTasksByProjectIDByUserID(projectID, userID);

            decimal ProjectTime = tasks.TotalTimeByUserIDByProjectID(userID, projectID);

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

            Output.Text = "You have worked " + ProjectTime.ToString() + " hrs on the " + ProjectsDropDownList.SelectedItem.Text + " project";
            MainMultiView.ActiveViewIndex = 1;
        }
        else
        {
            Server.Transfer("Reports.aspx");
        }
    }