/// <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."; } }
protected void Page_Load(object sender, EventArgs e) { TasksGridView.DataSource = ScheduledTasksCoordinator.Current.ScheduledTasks.Select(x => new { TaskName = x.Name, LastRunTime = x.LastRun, LastRunWasSuccessful = x.IsLastRunSuccessful, IsPaused = x.Pause, }).ToList(); TasksGridView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ResetControls(); TodayLB_Click(TodayLB, new System.EventArgs()); SetInfoBar(); //bind the Tasks gridview TasksGridView.DataBind(); } //set focus on form to time field and submit button Page.Form.DefaultFocus = TimeTextBox.ClientID; Page.Form.DefaultButton = SubmitButton.UniqueID; }