private void GridViewTasksDayOfWeek(string datetime, bool onlyMine) { int userId = -1; if (Session["role"] != null && Session["role"].Equals(Role.Admin)) { userId = -1; } else { userId = Convert.ToInt32(Session["id"]); } TasksBLL.expiringTask(); mondayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 2, datetime, onlyMine); mondayDataList.DataBind(); tuesdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 3, datetime, onlyMine); tuesdayDataList.DataBind(); wednesdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 4, datetime, onlyMine); wednesdayDataList.DataBind(); thursdayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 5, datetime, onlyMine); thursdayDataList.DataBind(); fridayDataList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 6, datetime, onlyMine); fridayDataList.DataBind(); saturdayDatList.DataSource = TasksBLL.GetAllTasksByUserIdComplyWithDayOfWeek(userId, 7, datetime, onlyMine); saturdayDatList.DataBind(); }
protected void handleUpdateTaskDetail(object sender, EventArgs e) { // get info task string titleTask = title.Text; String startDateTask = startDate.Text; String endDateTask = endDate.Text; String statusTask = status.Value; bool IsPrivate = privateScope.Checked; TasksDTO newTask = new TasksDTO(task.ID, titleTask, startDateTask, endDateTask, statusTask, IsPrivate, task.urlFile); // get list partner List <int> arr = new List <int>(); foreach (GridViewRow row in usersGridView.Rows) { CheckBox checkBox = (CheckBox)row.FindControl("checkbox"); if (checkBox.Checked) { arr.Add(Int32.Parse(usersGridView.DataKeys[row.RowIndex].Value.ToString())); } } TasksBLL.updateTask(newTask, arr); Helper.Toast(this, Page.ClientScript, "success", "Update task success"); TasksBLL.expiringTask(); renderActionButtons(); getValueTask(); initValue(); renderActionButtons(); loadDisEnInput(); }
/// <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 renderActionButtons() { int userId = Convert.ToInt32(Session["id"]); // Check current user exists in the list of partner or not int partnerIndex = arrPartnerId.FindIndex(u => u == userId); // Get owner id int ownerId = TasksBLL.getOwnerByTaskId(task.ID); if (partnerIndex != -1) { isPartner = true; } else { isPartner = false; } if (Convert.ToInt32(Session["id"].ToString()) == ownerId) { isOwner = true; isPartner = false; } else { isOwner = false; } }
protected void DisplayTaskByDate(DateTime start, DateTime end) { TasksBLL tasks = new TasksBLL(); //TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange((int)Session["userID"], start, end); TasksDataSource.SelectParameters.Clear(); TasksDataSource.SelectMethod = "GetTasksByUserIDByDateRange"; TasksDataSource.SelectParameters.Add(new Parameter("userID", TypeCode.String, Session["userID"].ToString())); TasksDataSource.SelectParameters.Add(new Parameter("start", TypeCode.DateTime, start.ToString())); TasksDataSource.SelectParameters.Add(new Parameter("end", TypeCode.DateTime, end.ToString())); decimal TotalTime = tasks.TotalTimeByUserIDByDateRange((int)Session["userID"], start, end); //TasksGridView.DataBind(); if (start == end) { StatsLabel.Text = "You worked " + TotalTime + " hrs on " + start.ToShortDateString(); } else { StatsLabel.Text = "You worked " + TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString(); } //ViewHelper("PickDay"); }
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 = ""; } }
private async void CheckTimedTask(object state) { List <TaskSch> timedTasks = TasksBLL.GetTimedTaskList(); var earliestStartTime = timedTasks.Min(task => task.StartTime); var now = DateTime.Now; var currentTime = new DateTime(1970, 1, 1, now.Hour, now.Minute, now.Second); //var leftBoundaryTime = currentTime.AddMinutes(-5); var rightBoundaryTime = currentTime.AddMinutes(5); if (earliestStartTime <= rightBoundaryTime) { var earliestTimedTasks = timedTasks.Where(task => task.StartTime == earliestStartTime); await ExecuteTimedTasks(earliestTimedTasks.ToList()); _timedTaskCheckTimer.Change(5 * 60000, Timeout.Infinite); } else { _timedTaskCheckTimer.Change(5 * 60000, Timeout.Infinite); } }
/// <summary> /// Submits a new task to the DB. Once complete will transfer the user back to the page to begin another task entry. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { TasksBLL task = new TasksBLL(); //to clean up the add task call we define everything here first DateTime date = Convert.ToDateTime(DateTextBox.SelectedDate); decimal time = Convert.ToDecimal(TimeTextBox.Text); int effort = Convert.ToInt32(ServiceDropDownList.SelectedValue); int project = Convert.ToInt32(ProjectDropDownList.SelectedIndex) == 0 ? -1 : Convert.ToInt32(ProjectDropDownList.SelectedValue); int user = (int)Session["userID"]; int phase = Convert.ToInt32(PhaseDropDown.SelectedIndex) == 0 ? -1 : Convert.ToInt32(PhaseDropDown.SelectedValue); int asset = Convert.ToInt32(AssetDropDown.SelectedIndex) == 0 ? -1 : Convert.ToInt32(AssetDropDown.SelectedValue); //int asset = Convert.ToInt32(AssetDropDown.SelectedValue); int category = Convert.ToInt32(CategoryDropDown.SelectedValue); if (task.AddTask(date, time, WorkDoneTextBox.Text, null, WOTextBox.Text, RFCTextBox.Text, effort, project, user, phase, asset, category)) { TodayLB_Click(TodayLB, new System.EventArgs()); TasksGridView.DataBind(); SetInfoBar(); StatsLabel.Text = "Task Added! " + StatsLabel.Text; ResetControls(); ScriptManager.SetFocus(TimeTextBox); } else { StatsLabel.Text = "Error: Task not added."; } }
private void GridViewTaskBind() { TasksBLL.expiringTask(); tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(Convert.ToInt32(Session["id"])); tasksGridView.DataBind(); int userId; if (Session["role"].Equals(Role.Admin)) { userId = -1; taskListHeader.Text = "ALL TASKS"; // Change title GridViewPublicTasks.Visible = false; taskListPublicHeader.Visible = false; // Change grid view tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(userId); tasksGridView.DataBind(); } else { userId = Convert.ToInt32(Session["id"]); tasksGridView.DataSource = TasksBLL.GetAllTasksByUserId(userId); tasksGridView.DataBind(); GridViewPublicTasks.DataSource = TasksBLL.GetAllTasksPublicExcludeUserId(userId); GridViewPublicTasks.DataBind(); } }
protected void HandleDeleteTask(object sender, GridViewDeleteEventArgs e) { string taskId = tasksGridView.DataKeys[e.RowIndex].Value.ToString(); int result = TasksBLL.DeleteTaskById(taskId); GridViewTaskBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["name"] == null) { Response.Redirect("/login"); } if (Session["role"] != null && !Session["role"].Equals(Role.Admin)) { Response.Redirect("/login"); } int userId = Convert.ToInt32(Request.QueryString["id"]); UsersDTO user = UsersBLL.getUserById(userId); if (user == null) { Response.Redirect("/users"); } lbEmail.Text = user.Email; lbName.Text = user.Name; lbRole.Text = user.Role; TasksBLL.expiringTask(); }
private static void HandleInfo(VerificationCode verificationCode) { Console.WriteLine($"手机号:{verificationCode.PhoneNum}, 验证码:{verificationCode.Code}"); try { var obj = new JObject() { { "tasktype", (int)TaskType.SendVerificationCode }, { "txtmsg", verificationCode.Code } }; var list = new JArray(); obj.Add("list", list); int vmIndex = VmManager.Instance.VmModels.Values.FirstOrDefault(vm => vm.PhoneNumber == verificationCode.PhoneNum).Index; TaskSch taskSch = new TaskSch() { Bodys = obj.ToString(Formatting.None), MobileIndex = vmIndex, TypeId = (int)TaskType.SendVerificationCode, Status = "waiting", }; TasksBLL.CreateTask(taskSch); ConfigVals.IsRunning = 1; TasksSchedule tasks = new TasksSchedule(); tasks.ProessTask(); } catch (Exception ex) { LogUtils.Error($"{ex}"); } }
/// <summary> /// 通过好友请求 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_AllowRequestSubmitTask_Click(object sender, RoutedEventArgs e) { List <int> targets = new List <int>(); foreach (var item in treeviewAllowRequestFriend.ItemsSourceData) { foreach (var subItem in item.Children) { if (subItem.IsChecked) { targets.Add((int)subItem.Id - 1); } } } if (targets.Count() == 0) { MessageDialogManager.ShowDialogAsync(SystemLanguageManager.Instance.ResourceManager.GetString("Select_Vm", SystemLanguageManager.Instance.CultureInfo)); return; } List <int> checkMobiles = targets.ToList(); TaskSch task = new TaskSch(); TasksBLL bll = new TasksBLL(); int nums = 0; for (int m = 0; m < checkMobiles.Count; m++) { var lists = new JArray { }; var obj = new JObject() { { "opernums", txt_AllowRequestFriend.Text }, { "tasktype", (int)TaskType.AllowRequestFriend }, { "txtmsg", "" } }; obj.Add("list", lists); task.TypeId = (int)TaskType.AllowRequestFriend; task.Remotes = checkMobiles[m].ToString(); task.MobileIndex = checkMobiles[m]; task.Bodys = obj.ToString(Formatting.None); task.Status = "waiting"; task.ResultVal = ""; task.RepeatNums = Int32.Parse(txt_AllowRequestFriend.Text); task.RandomMins = Int32.Parse(txt_AllowRequestMinFriend.Text); task.RandomMaxs = Int32.Parse(txt_AllowRequestMaxFriend.Text); task.IsWhole = 0;//checkIsWholeRequestFriend.IsChecked==true ? 1 : 0; task.IsStep = 1; task.StartTime = TimedTaskManager.Instance.StartTime; TasksBLL.CreateTask(task); nums++; } //启动任务列表 GlobalTaskManager.Instance.StartCheckingGlobalTasks(); MessageDialogManager.ShowDialogAsync(string.Format(SystemLanguageManager.Instance.ResourceManager.GetString("Submitted_Task", SystemLanguageManager.Instance.CultureInfo), nums)); }
private void getValueTask() { TasksBLL.expiringTask(); int taskId = Convert.ToInt32(Request.QueryString["id"]); task = TasksBLL.getTaskByTaskId(taskId); }
/// <summary> /// 删除全局任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDeleteTask_Click(object sender, RoutedEventArgs e) { if (System.Windows.Forms.MessageBox.Show(resourceManager.GetString("Delete_Task_Tips", cultureInfo), resourceManager.GetString("Delete_Task_Confirmation", cultureInfo), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { TasksBLL.DeleteTypeTasks(2); getTasksList(); } }
public TaskTakeDown() { InitializeComponent(); _projectBLL = new ProjectBLL(); _projectEmployeesBLL = new ProjectEmployeesBLL(); _taskBLL = new TasksBLL(); ManagerID = employee.EmployeeID; _customerRequestBLL = new CustomerRequestBLL(); }
public ActionResult Edit([Bind(Include = "id_task,title,descr,asigned_to,id_list")] Task task) { if (ModelState.IsValid) { TasksBLL.Update(task); return(RedirectToAction("Index")); } ViewBag.id_list = new SelectList(db.List, "id_list", "name_list", task.id_list); return(View(task)); }
protected void handleRemindTask(object sender, EventArgs e) { string content = chatBox.Text; TasksBLL.createComment(Convert.ToInt32(Session["id"].ToString()), task.ID, content, true); bindComment(); // reset chatBox.Text = ""; }
/// <summary> /// 通过好友请求 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_AllowRequestSubmitTask_Click(object sender, RoutedEventArgs e) { var targets = from item in treeviewAllowRequestFriend.ItemsSourceData.FirstOrDefault().Children where item.IsChecked select(int) item.Id - 1; if (targets.Count() == 0) { MessageDialogManager.ShowDialogAsync(SystemLanguageManager.Instance.ResourceManager.GetString("Select_Vm", SystemLanguageManager.Instance.CultureInfo)); return; } List <int> checkMobiles = targets.ToList(); TaskSch task = new TaskSch(); TasksBLL bll = new TasksBLL(); int nums = 0; for (int m = 0; m < checkMobiles.Count; m++) { var lists = new JArray { }; var obj = new JObject() { { "opernums", txt_AllowRequestFriend.Text }, { "tasktype", (int)TaskType.AllowRequestFriend }, { "txtmsg", "" } }; obj.Add("list", lists); task.TypeId = (int)TaskType.AllowRequestFriend; task.Remotes = checkMobiles[m].ToString(); task.MobileIndex = checkMobiles[m]; task.Bodys = obj.ToString(Formatting.None); task.Status = "waiting"; task.ResultVal = ""; task.RepeatNums = Int32.Parse(txt_AllowRequestFriend.Text); task.RandomMins = Int32.Parse(txt_AllowRequestMinFriend.Text); task.RandomMaxs = Int32.Parse(txt_AllowRequestMaxFriend.Text); task.IsWhole = 0;//checkIsWholeRequestFriend.IsChecked==true ? 1 : 0; task.IsStep = 1; TasksBLL.CreateTask(task); nums++; } //启动任务列表 if (ConfigVals.IsRunning != 1) { Task.Run(async() => { await ProessTask(); }); } MessageDialogManager.ShowDialogAsync(string.Format(SystemLanguageManager.Instance.ResourceManager.GetString("Submitted_Task", SystemLanguageManager.Instance.CultureInfo), nums)); }
public IHttpActionResult PostTask(Task task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } TasksBLL.Create(task); return(CreatedAtRoute("DefaultApi", new { id = task.id_task }, task)); }
public IHttpActionResult GetTask(int id) { Task task = TasksBLL.Get(id); if (task == null) { return(NotFound()); } return(Ok(task)); }
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 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 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; }
// GET: Tasks/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Task task = TasksBLL.Get(id); if (task == null) { return(HttpNotFound()); } return(View(task)); }
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(); } }
protected void handleSubmitComment(object sender, EventArgs e) { string content = chatBox.Text; if (string.IsNullOrEmpty(content)) { Helper.Toast(this, Page.ClientScript, "info", "Please input comment"); return; } TasksBLL.createComment(Convert.ToInt32(Session["id"].ToString()), task.ID, content, false); bindComment(); // reset chatBox.Text = ""; }
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."; }
// GET: Tasks/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Task task = TasksBLL.Get(id); if (task == null) { return(HttpNotFound()); } ViewBag.id_list = new SelectList(db.List, "id_list", "name_list", task.id_list); return(View(task)); }
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; }
public IHttpActionResult PutTask(int id, Task task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != task.id_task) { return(BadRequest()); } TasksBLL.Update(task); return(StatusCode(HttpStatusCode.NoContent)); }
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; }
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"); } }
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 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"); }
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(); }
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"); }
/// <summary> /// Updates the task. Once complete will transfer the user back to the Tasks.aspx page to begin another task entry. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UpdateButton_Click(object sender, EventArgs e) { TasksBLL task = new TasksBLL(); //to clean up the add task call we define everything here first DateTime date = Convert.ToDateTime(DateTextBox.SelectedDate); decimal time = Convert.ToDecimal(TimeTextBox.Text); int effort = Convert.ToInt32(ServiceDropDownList.SelectedValue); int project = Convert.ToInt32(ProjectDropDownList.SelectedIndex) == 0 ? -1 : Convert.ToInt32(ProjectDropDownList.SelectedValue); int user = (int)Session["userID"]; int phase = Convert.ToInt32(PhaseDropDown.SelectedIndex) == 0 ? -1 : Convert.ToInt32(PhaseDropDown.SelectedValue); int asset = Convert.ToInt32(AssetDropDown.SelectedIndex) == 0 ? -1 : Convert.ToInt32(AssetDropDown.SelectedValue); int category = Convert.ToInt32(CategoryDropDown.SelectedValue); if (task.UpdateTask(date, time, WorkDoneTextBox.Text, null, WOTextBox.Text, RFCTextBox.Text, effort, project, user, phase, asset, category, Convert.ToInt32(Request.QueryString["t"]))) { StatsLabel.Text = "Task Updated!"; Server.Transfer("Tasks.aspx"); } else StatsLabel.Text = "Error: Task could not be updated."; }