コード例 #1
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        DateTime timeNow;
        DateTime StartTime;

        timeNow   = System.DateTime.Now;
        StartTime = Convert.ToDateTime(rdtimepStartTime.Text);
        long i = StartTime.Ticks - timeNow.Ticks;

        if (StartTime.Ticks - timeNow.Ticks > 0 || StartTime.Ticks - timeNow.Ticks == 0)
        {
            //创建job
            BLL_JOB     = new JOB();
            flagSuccess = BLL_JOB.Create(this.KeyId, "Insert");

            if (flagSuccess != string.Empty) //成功更新Task的jobId字段
            {
                GetData();                   //查询数据
                System.Guid KeyIdGuid = new Guid(flagSuccess);
                SchedulerObj.JobID = KeyIdGuid;
                updateSuccess      = BLL_ScheduleTasks.UpdateInTaskView(SchedulerObj);

                if (updateSuccess == true)
                {
                    Response.Redirect("~/Schedule Billing/ScheduleTasksForm.aspx?SuccessFlag=" + updateSuccess);
                }
                else
                {
                    //更新task失败
                    MessageBox(false, false, true,
                               GetGlobalResourceObject("WebResource", "TaskDetailFormView_UpdateTask_ErrorMessage").ToString());
                }
            }
            else
            {
                //生成job失败
                MessageBox(false, false, true,
                           GetGlobalResourceObject("WebResource", "TaskDetailFormView_ConfirmMessage_ErrorMessage").ToString());
            }
        }
        else
        {
            //StartTime小于系统时间,不允许保存
            MessageBox(false, false, true,
                       GetGlobalResourceObject("WebResource", "TaskDetailFormView_StartTime_ErrorMessage").ToString());
        }
    }