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");
        }
    }
Esempio n. 2
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");
        }
    }