private void fillData() { int taskID = 0; foreach (TaskInfo info in BusinessLogicLayer.TaskInfo.getTasks()) { if (info.TaskName == taskDrpList.SelectedItem.ToString()) { taskID = info.TaskID; break; } } BusinessLogicLayer.TaskInfo task = TaskInfo.getAssignedTask(taskID); BusinessLogicLayer.WorkTypeInfo workTypeInfo = WorkTypeInfo.getWorkType(task.WorkTypeID); workTypeDrpList.SelectedValue = workTypeInfo.Name == workTypeInfo.Project.Name ? workTypeInfo.Name : workTypeInfo.Project.Name + " - " + workTypeInfo.Name; taskNameTxtBx.Text = task.TaskName; taskDescTxtBx.Text = task.TaskDescription; takeFiveChkBx.Checked = task.TakeFiveNeeded; reasonTxtBx.Text = task.TaskIncompleteReason; taskStatDrpList.SelectedValue = task.TaskStatus; submitTask.Visible = false; }
protected void updateSubmitBtn_Click(object sender, EventArgs e) { int taskID = 0; foreach (TaskInfo info in BusinessLogicLayer.TaskInfo.getTasks()) { if (info.TaskName == taskDrpList.SelectedItem.ToString()) { taskID = info.TaskID; break; } } BusinessLogicLayer.TaskInfo editTask = TaskInfo.getAssignedTask(taskID); foreach (WorkTypeInfo type in BusinessLogicLayer.WorkTypeInfo.getAllWorkTypes()) { if (type.Project.Name == type.Name) { if (type.Project.Name == workTypeDrpList.SelectedItem.ToString()) { editTask.WorkTypeID = type.WorkTypeID; break; } } else if (type.Project.Name + " - " + type.Name == workTypeDrpList.SelectedItem.ToString()) { editTask.WorkTypeID = type.WorkTypeID; break; } } if (taskNameTxtBx.Text != "") { editTask.TaskName = taskNameTxtBx.Text; } if (taskDescTxtBx.Text != "") { editTask.TaskDescription = taskDescTxtBx.Text; } editTask.TakeFiveNeeded = takeFiveChkBx.Checked; editTask.TaskStatus = taskStatDrpList.SelectedItem.ToString(); if (reasonTxtBx.Text != "") { editTask.TaskIncompleteReason = reasonTxtBx.Text; } editTask.updateDatabase(); taskSub.ForeColor = System.Drawing.ColorTranslator.FromHtml("#7E7E7E"); taskSub.Text = "Task updated."; taskSub.Visible = true; Response.Redirect("/taskmanagement.aspx?id=" + workTypeID.ToString() + "&update=true"); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Params.Get("id") == null) { Response.Redirect("todo.aspx"); } BusinessLogicLayer.TaskInfo info = TaskInfo.getAssignedTask(Convert.ToInt32(Request.QueryString["id"])); BusinessLogicLayer.WorkTypeInfo workTypeInfo = WorkTypeInfo.getWorkType(info.WorkTypeID); HtmlGenericControl NewControl = new HtmlGenericControl("span"); taskTitleLbl.Text = info.TaskName; dueDateLbl.Text = "DUE: " + info.TaskDueDate.ToShortDateString(); taskDescTxtBx.TextMode = TextBoxMode.MultiLine; taskDescTxtBx.Text = info.TaskDescription; sectionProjLbl.Text = workTypeInfo.Project.Name == workTypeInfo.Name ? workTypeInfo.Name : workTypeInfo.Project.Name + " - " + workTypeInfo.Name; }