示例#1
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            var formList = this.DataHelper.Set <SysForm>().Where(p => p.State == (int)FormState.StartUsed).ToList();

            this.ddlForm.DataSource = formList;
            this.ddlForm.DataBind();

            long?id = QueryString <long?>("id");

            if (id == null)
            {
                this.txtProcessName.SetValue(null);
                this.ddlForm.SetValue(null);

                this.ProcessId = this.DataHelper.GetNextIdentity();
            }
            else
            {
                SysProcess process = this.DataHelper.FindById <SysProcess>(id);
                if (process != null)
                {
                    //不是“新增”状态,需要复制一份
                    if (process.ProcessStatus != (int)ProcessState.Created)
                    {
                        FormProcessPublishHelper helper = new FormProcessPublishHelper(process);
                        SysProcess newProcess           = helper.CopyProcess();

                        this.ProcessId           = newProcess.ProcessId;
                        this.txtProcessName.Text = newProcess.ProcessName;
                        this.ddlForm.SetValue(newProcess.FormId);
                    }
                    else
                    {
                        this.ProcessId           = id.Value;
                        this.txtProcessName.Text = process.ProcessName;
                        this.ddlForm.SetValue(process.FormId);
                    }
                }
                else
                {
                    throw new Exception("参数不正确");
                }
            }

            this.hc.Value = this.ProcessId.ToString();
            this.hc.Text  = this.ClientScript.GetPostBackEventReference(this.hc, "refresh");

            BindGrid();
            BindDropDown();
        }
        /// <summary>
        /// 发布
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPublish_Click(object sender, EventArgs e)
        {
            try
            {
                SysProcess process = this.DataHelper.FindById <SysProcess>(this.ProcessId);
                FormProcessPublishHelper helper = new FormProcessPublishHelper(process);
                helper.Publish();

                this.AjaxAlertAndRedirect("发布成功", "FormProcessQuery.aspx");
            }
            catch (Exception ex)
            {
                this.AjaxAlertAndEnableButton(ex);
            }
        }
示例#3
0
 /// <summary>
 /// 启用活动
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnStart_Click(object sender, EventArgs e)
 {
     try
     {
         long?      processId            = (sender as LinkButton).CommandArgument.ToLongNullable();
         SysProcess process              = this.DataHelper.FindById <SysProcess>(processId);
         FormProcessPublishHelper helper = new FormProcessPublishHelper(process);
         helper.StartProcess();
         BindGrid();
     }
     catch (Exception ex)
     {
         this.AjaxAlert(ex);
     }
 }