/// <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(); } }
/// <summary> /// ������һ�������� /// </summary> /// <param name="functionNo">����</param> /// <param name="recordValue">����ֵ</param> /// <param name="recordTitle">����</param> /// <param name="applyEmpId">������id</param> /// <param name="checkEmp">������ִ����</param> /// <returns>�Ƿ��Զ�����</returns> public bool ApplyChange(string functionNo, string recordValue, string recordTitle, int applyEmpId, string checkEmp) { WFunctionBB functionBB = new WFunctionBB(); try { //�жϹ������Ƿ��Զ����� if (functionBB.IsAutoAudit(functionNo)) { //���µ���״̬ this.SetWorkFlowInfo(functionNo, recordValue, WorkFlowState.WorkSubmiting, applyEmpId.ToString(), DateTime.Now.ToString()); return true; } else { //�жϵ�ǰ������������������ //�����������û�н�����������ֱ�Ӹ��µ���״̬����ֹ������ //����Ѿ����������ͱ����Ϣ����ǰ������ SqlTransaction trans = null; try { if (this.transaction == null) { trans = this.connection.BeginTransaction("TransUnSubmit"); this.runListBB.Transaction = trans; this.commBB.Transaction = trans; } //ȡ�����һ���������� int runNo = this.runListBB.GetLastRunNo(functionNo, recordValue, 0); //ȡ�������������ĵ�ǰ���� int stepNo = this.runListBB.GetLastStepNo(functionNo, recordValue, 0, runNo); //�ж���û�������� bool isSubmited = this.runListBB.GetIsSubmited(functionNo, recordValue, 0, runNo); if (!isSubmited) { //���µ���״̬ this.SetWorkFlowInfo(functionNo, recordValue, WorkFlowState.WorkSubmiting, "", ""); //����һ��������������ϢΪ���� string strSql = "update WRunList set isEnd=1 from WRunList a inner join WFunctionStep b" + " on a.stepId=b.id where a.functionNo='" + functionNo + "' and a.recordValue='" + recordValue + "' and a.runNo=" + runNo.ToString() + " and b.stepNo=" + stepNo.ToString() + " and isApplyChange=0"; this.commBB.ExecuteSql(strSql); } else { //��������������������Ӧ������������ this.Submit(functionNo, recordValue, recordTitle, applyEmpId, stepNo, 2, checkEmp); } if (this.transaction == null) trans.Commit(); } catch (Exception ex) { if (this.transaction == null) trans.Rollback("TransUnSubmit"); throw ex; } return false; } } finally { functionBB.Dispose(); } }