protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        ClassJob oJob = new ClassJob(Convert.ToInt32(ViewState["JobId"].ToString()));
        double HoursVal;

        if (double.TryParse(this.TxtBudgetHours.Text, out HoursVal) != true)
        {
            //	Problem with the hours figure.

            ShowTimeError("Hours are incorrectly specified!");
        }
        else
        {
            oJob.TaskId = Convert.ToInt32(this.DdlTasks.SelectedValue);
            oJob.JobRef = this.TxtJobRef.Text;
            oJob.Description = this.TxtDescription.Text;
            oJob.BudgetHours = Convert.ToDouble(this.TxtBudgetHours.Text);
            oJob.Active = this.ChkActive.Checked;
            oJob.Save(Convert.ToInt32(ViewState["JobId"].ToString()));

            ShowJobs(0);
            ShowJob(0);
            ViewState["JobId"] = "0";
            this.BtnSubmit.Text = "Submit";
        }
    }
    protected void BtnUpdateActive_Click(object sender, System.EventArgs e)
    {
        for (Int32 RowNo = 0; RowNo < this.GridJob.Rows.Count; RowNo++)
        {
            GridViewRow oRow = this.GridJob.Rows[RowNo];
            Label oLbl = (Label)oRow.FindControl("LblJobId");

            if (oLbl != null)
            {
                CheckBox oChk = (CheckBox)oRow.FindControl("ChkActive");

                if (oChk != null)
                {
                    ClassJob oJob = new ClassJob(Convert.ToInt32(oLbl.Text));

                    oJob.Active = oChk.Checked;
                    oJob.Save(oJob.JobId);
                }
            }
        }
    }
示例#3
0
    public DataSet GetJobListForTask(string UsrNam, string UsrPwd, Int32 TaskId, Boolean bOnlyActive)
    {
        DataSet oDs = null;

        try
        {
            Int32 UserId = GetUserId(UsrNam, UsrPwd);

            if (UserId > 0)
            {
                ClassJob oJob = new ClassJob();

                oDs = oJob.ShowJobsForTask(TaskId, bOnlyActive);
            }
        }

        catch (Exception ex)
        {
            Log.LogMsg(ex.Message);
        }

        return oDs;
    }
    private void ShowJobs(Int32 PageNo)
    {
        this.GridJob.DataSource = null;

        if (this.DdlTasks.Items.Count > 0)
        {
            ClassJob oJob = new ClassJob();
            DataSet oDs = oJob.ShowJobsForTask(Convert.ToInt32(this.DdlTasks.SelectedValue), false);

            if (oDs != null)
            {
                if (oDs.Tables.Count > 0)
                {
                    if (oDs.Tables[0].Rows.Count > 0)
                    {
                        this.GridJob.DataSource = oDs;

                        if (this.GridJob.Rows.Count > 0)
                            this.GridJob.PageIndex = PageNo;

                        this.GridJob.DataBind();
                    }
                }
            }
        }
    }
    private void ShowJob(Int32 JbId)
    {
        ShowTimeError("");

        ClassJob oJob = new ClassJob(JbId);

        this.TxtJobRef.Text = oJob.JobRef;
        this.TxtDescription.Text = oJob.Description;
        this.TxtBudgetHours.Text = string.Format("{0:f2}", oJob.BudgetHours);
        this.ChkActive.Checked = (oJob.Active == true);
    }
    protected void GridJob_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "Delete":
                ClassJob oJob = new ClassJob();

                oJob.Delete(Convert.ToInt32(e.CommandArgument));
                ShowJobs(0);
                break;

            case "Edit":
                ViewState["JobId"] = Convert.ToInt32(e.CommandArgument).ToString();
                ShowJob(Convert.ToInt32(e.CommandArgument));
                this.BtnSubmit.Text = "Update";
                break;
        }
    }
    private void ShowJobs(Int32 TskId)
    {
        //ClassTask oTsk = new ClassTask(Convert.ToInt32(this.DdlTasks.SelectedValue));

        //if ((oTsk.ValidationType & (Int32)Enum.ValidationType.UseDropDownListBox) != 0)
        //{
            //	We are using a dropdown listbox of possible job reference values.

            ClassJob oJob = new ClassJob();
            DataSet oDs = oJob.ShowJobsForTask(TskId, true);
            Boolean bShow = false;

            if (oDs != null)
            {
                if (oDs.Tables.Count > 0)
                {
                    if (oDs.Tables[0].Rows.Count > 0)
                        bShow = true;
                }
            }

            //this.DdlJobs.Items.Clear();

            if (bShow == true)
            {
                //this.DdlJobs.DataSource = oDs;
                //this.DdlJobs.DataTextField = "JobRef";
                //this.DdlJobs.DataValueField = "JobRef";
                //this.DdlJobs.DataBind();

                //this.TxtReference.Visible = false;
                //this.DdlJobs.Visible = true;
            }
            else
            {
                //	No pre-defined values exist for dropdown.
                //	User must enter a value.

                //this.TxtReference.Visible = true;
                //this.DdlJobs.Visible = false;
            }
        //}
        //else
        //{
            //	User needs to enter a value.

            //this.TxtReference.Visible = true;
            //this.DdlJobs.Visible = false;
        //}
    }
示例#8
0
 /// <summary>
 /// Executes a class job, and returns the result.
 /// </summary>
 public async Task <ClassJobResult> ExecuteClassJobAsync(ClassJob classJob)
 {
     return(await ExecuteCodeJobAsync <ClassJob, ClassJobResult>(classJob));
 }
示例#9
0
 public async Task <CodeJobResult> ExecuteClassJob([FromBody] ClassJob job)
 {
     return(await _codeRunnerService.ExecuteClassJobAsync(job));
 }