/// <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."; } }