示例#1
0
        /// <summary>
        /// 从数据库创建Process类。
        /// </summary>
        /// <param name="processID">流程ID。</param>
        /// <returns>流程类。</returns>
        public static Process CreateProcess(GUIDEx processID)
        {
            lock (ModuleUtils.SynchronizedObject)
            {
                Process process = null;
                if (processID.IsValid)
                {
                    #region 流程信息。
                    FlowProcessEntity flowProcessEntity = new FlowProcessEntity();
                    FlowStepEntity flowStepEntity = new FlowStepEntity();
                    FlowTransitionEntity flowTransitionEntity = new FlowTransitionEntity();

                    FlowProcess p = new FlowProcess();
                    p.ProcessID = processID;
                    if (flowProcessEntity.LoadRecord(ref p))
                    {
                        process = new Process();
                        process.ProcessID = p.ProcessID;
                        process.ProcessName = p.ProcessName;
                        process.ProcessSign = p.ProcessSign;
                        process.BeginDate = p.BeginDate;
                        process.EndDate = p.EndDate;
                        process.ProcessDescription = p.ProcessDescription;

                        #region 步骤信息。
                        process.Steps = flowStepEntity.LoadStepCollection(process.ProcessID);
                        #endregion

                        #region 变迁规则。
                        process.Transitions = flowTransitionEntity.LoadTransitionCollection(process.ProcessID);
                        #endregion
                    }
                    #endregion
                }
                return process;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                FlowProcess data = new FlowProcess();
                data.ProcessID = this.ProcessID.IsValid ? this.ProcessID : GUIDEx.New;
                data.ProcessName = this.txtProcessName.Text;
                data.ProcessSign = this.txtProcessSign.Text;
                data.BeginDate = Convert.ToDateTime(this.txtBeginDate.Text);
                data.EndDate = Convert.ToDateTime(this.txtEndDate.Text);
                data.ProcessStatus = Convert.ToInt32(this.ddlProcessStatus.SelectedValue);
                data.ProcessDescription = this.txtProcessDescription.Text;

                if (this.presenter.UpdateData(data))
                    base.SaveData();
            }
            catch (Exception ex)
            {
                this.ShowMessage(ex.Message);
            }
        }