示例#1
0
        /// <summary>
        /// �����ύһ���������������ύ��ָ���Ĺ�����ִ����
        /// </summary>
        /// <param name="functionNo">����</param>
        /// <param name="recordValue">����ֵ</param>
        /// <param name="recordTitle">����</param>
        /// <param name="submitEmpId">�ύ��id</param>
        /// <param name="checkEmp">������ִ����</param>
        /// <returns>�Ƿ��Զ�����</returns>
        public bool Submit(string functionNo, string recordValue, string recordTitle, int submitEmpId, string checkEmp)
        {
            WFunctionBB functionBB = new WFunctionBB();
            try
            {
                //�жϹ������Ƿ��Զ�����
                if (functionBB.IsAutoAudit(functionNo))
                {
                    //���µ���״̬
                    this.SetWorkFlowInfo(functionNo, recordValue, WorkFlowState.WorkAudited,
                        submitEmpId.ToString(), DateTime.Now.ToString());
                    return true;
                }
                else
                {

                    WFunctionStepBB functionStepBB = new WFunctionStepBB();
                    try
                    {
                        this.Submit(functionNo, recordValue, recordTitle, submitEmpId, functionStepBB.GetNextStep(functionNo, 0), 0, checkEmp);
                    }
                    finally
                    {
                        functionStepBB.Dispose();
                    }
                    return false;
                }
            }
            finally
            {
                functionBB.Dispose();
            }
        }
示例#2
0
        /// <summary>
        /// ������������׼
        /// </summary>
        /// <param name="runId">��������¼Id</param>
        /// <param name="auditEmpId">������</param>
        /// <returns>������������־</returns>
        public bool Agree(int runId, int auditEmpId)
        {
            //������������׼ʱ�����¹�������Ϣ״̬
            //�����������������ȫ���������ж��������һ�����������һ���蹤����
            //��������������ɣ�����ԭʼ����״̬
            bool ret = false;
            WRunListData model = new WRunListData();
            vWRunListData vmodel = new vWRunListData();
            WFunctionStepBB functionStepBB = new WFunctionStepBB();

            SqlTransaction trans = null;
            try
            {
                if (this.transaction == null)
                {
                    trans = this.connection.BeginTransaction("TransAgree");
                    this.runListBB.Transaction = trans;
                    this.commBB.Transaction = trans;
                }

                //���¹�������¼״̬
                model = this.runListBB.GetModel(runId);
                vmodel = this.runListBB.GetVModel(runId);

                if (model.workFlowState != WorkFlowState.WorkAuditing || model.isEnd)
                {
                    throw new Exception("ԭʼ����״̬�Ѿ��ı���������Ѿ��������޷�������");
                }

                model.auditEmpId = auditEmpId;
                model.auditDt = DateTime.Now.ToString();
                model.workFlowState = WorkFlowState.WorkAudited;
                model.workFlowSeq = WorkFlowState.GetWorkFlowStateDesc(WorkFlowState.WorkAudited);
                model.isEnd = true;
                this.runListBB.ModifyRecord(model);

                //�жϱ����蹤�����Ƿ���ȫ������
                DataSet ds = new DataSet();
                ds = this.runListBB.GetVList("functionNo='" + vmodel.functionNo + "' and recordValue='"
                    + vmodel.recordValue + "' and runNo=" + vmodel.runNo.ToString() + " and stepNo="
                    + vmodel.stepNo.ToString() + " and isApplyChange=0 and isEnd=0");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //�ж��Ƿ�����һ����������
                    ds.Clear();
                    ds = functionStepBB.GetNextStepList(vmodel.functionNo, vmodel.stepNo);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        //���͹���������һ����
                        this.Submit(vmodel.functionNo, vmodel.recordValue, vmodel.recordTitle, vmodel.empId,
                            functionStepBB.GetNextStep(vmodel.functionNo, vmodel.stepNo), 1, "");
                    }
                    else
                    {
                        //���µ���״̬
                        this.SetWorkFlowInfo(vmodel.functionNo, vmodel.recordValue, WorkFlowState.WorkAudited,
                            auditEmpId.ToString(), DateTime.Now.ToString());
                        ret = true;
                    }
                }

                if (this.transaction == null) trans.Commit();
            }
            catch (Exception ex)
            {
                if (this.transaction == null) trans.Rollback("TransAgree");
                throw ex;
            }
            finally
            {
                functionStepBB.Dispose();
            }
            return ret;
        }