Beispiel #1
0
    /// <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.";
    }