/// <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; }
/// <summary> /// �������������� /// </summary> /// <param name="runId">��������¼Id</param> /// <param name="auditEmpId">������</param> public void UnAgreeChange(int runId, int auditEmpId) { //���¹�������Ϣ״̬ //����ͬ���蹤������ϢΪ���� WRunListData model = new WRunListData(); vWRunListData vmodel = new vWRunListData(); SqlTransaction trans = null; try { if (this.transaction == null) { trans = this.connection.BeginTransaction("TransUnAgreeChange"); 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.WorkUnAudited; model.workFlowSeq = WorkFlowState.GetWorkFlowStateDesc(WorkFlowState.WorkUnAudited); model.isEnd = true; this.runListBB.ModifyRecord(model); //����ͬ���蹤������ϢΪ���� string strSql = "update WRunList set isEnd=1 from WRunList a inner join WFunctionStep b" + " on a.stepId=b.id where a.functionNo='" + vmodel.functionNo + "' and a.recordValue='" + vmodel.recordValue + "' and a.runNo=" + vmodel.runNo.ToString() + " and b.stepNo=" + vmodel.stepNo + " and isApplyChange=1"; this.commBB.ExecuteSql(strSql); if (this.transaction == null) trans.Commit(); } catch (Exception ex) { if (this.transaction == null) trans.Rollback("TransUnAgreeChange"); throw ex; } }
/// <summary> /// �õ�һ����ͼmodel /// </summary> /// <param name="id">����ֵ</param> /// <returns>model</returns> public vWRunListData GetVModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from vWRunList"); strSql.Append(" where id = @id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int) }; parameters[0].Value = id; vWRunListData model = new vWRunListData(); DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; if (row["id"] != DBNull.Value) { model.id = Convert.ToInt32(row["id"]); } if (row["functionNo"] != DBNull.Value) { model.functionNo = Convert.ToString(row["functionNo"]); } if (row["runNo"] != DBNull.Value) { model.runNo = Convert.ToInt32(row["runNo"]); } if (row["stepId"] != DBNull.Value) { model.stepId = Convert.ToInt32(row["stepId"]); } if (row["isApplyChange"] != DBNull.Value) { model.isApplyChange = Convert.ToBoolean(row["isApplyChange"]); } if (row["empId"] != DBNull.Value) { model.empId = Convert.ToInt32(row["empId"]); } if (row["recordValue"] != DBNull.Value) { model.recordValue = Convert.ToString(row["recordValue"]); } if (row["recordTitle"] != DBNull.Value) { model.recordTitle = Convert.ToString(row["recordTitle"]); } if (row["doEmp"] != DBNull.Value) { model.doEmp = Convert.ToString(row["doEmp"]); } if (row["creattime"] != DBNull.Value) { model.creattime = Convert.ToString(row["creattime"]); } if (row["isRead"] != DBNull.Value) { model.isRead = Convert.ToBoolean(row["isRead"]); } if (row["readTime"] != DBNull.Value) { model.readTime = Convert.ToString(row["readTime"]); } if (row["auditEmpId"] != DBNull.Value) { model.auditEmpId = Convert.ToInt32(row["auditEmpId"]); } if (row["auditDt"] != DBNull.Value) { model.auditDt = Convert.ToString(row["auditDt"]); } if (row["workFlowState"] != DBNull.Value) { model.workFlowState = Convert.ToString(row["workFlowState"]); } if (row["workFlowSeq"] != DBNull.Value) { model.workFlowSeq = Convert.ToString(row["workFlowSeq"]); } if (row["auditMark"] != DBNull.Value) { model.auditMark = Convert.ToString(row["auditMark"]); } if (row["isEnd"] != DBNull.Value) { model.isEnd = Convert.ToBoolean(row["isEnd"]); } if (row["downFileNm"] != DBNull.Value) { model.downFileNm = Convert.ToString(row["downFileNm"]); } if (row["workflowNm"] != DBNull.Value) { model.workflowNm = Convert.ToString(row["workflowNm"]); } if (row["workTableNm"] != DBNull.Value) { model.workTableNm = Convert.ToString(row["workTableNm"]); } if (row["recordKeyField"] != DBNull.Value) { model.recordKeyField = Convert.ToString(row["recordKeyField"]); } if (row["keyIsInt"] != DBNull.Value) { model.keyIsInt = Convert.ToBoolean(row["keyIsInt"]); } if (row["titleField"] != DBNull.Value) { model.titleField = Convert.ToString(row["titleField"]); } if (row["itemNo"] != DBNull.Value) { model.itemNo = Convert.ToString(row["itemNo"]); } if (row["isRun"] != DBNull.Value) { model.isRun = Convert.ToBoolean(row["isRun"]); } if (row["stopMark"] != DBNull.Value) { model.stopMark = Convert.ToString(row["stopMark"]); } if (row["functionNm"] != DBNull.Value) { model.functionNm = Convert.ToString(row["functionNm"]); } if (row["functionUrl"] != DBNull.Value) { model.functionUrl = Convert.ToString(row["functionUrl"]); } if (row["functionChangeUrl"] != DBNull.Value) { model.functionChangeUrl = Convert.ToString(row["functionChangeUrl"]); } if (row["useEmpField"] != DBNull.Value) { model.useEmpField = Convert.ToString(row["useEmpField"]); } if (row["auditEmpIdField"] != DBNull.Value) { model.auditEmpIdField = Convert.ToString(row["auditEmpIdField"]); } if (row["auditDtField"] != DBNull.Value) { model.auditDtField = Convert.ToString(row["auditDtField"]); } if (row["workFlowStateField"] != DBNull.Value) { model.workFlowStateField = Convert.ToString(row["workFlowStateField"]); } if (row["workFlowSeqField"] != DBNull.Value) { model.workFlowSeqField = Convert.ToString(row["workFlowSeqField"]); } if (row["auditMarkField"] != DBNull.Value) { model.auditMarkField = Convert.ToString(row["auditMarkField"]); } if (row["auditDegreeField"] != DBNull.Value) { model.auditDegreeField = Convert.ToString(row["auditDegreeField"]); } if (row["windowHeight"] != DBNull.Value) { model.windowHeight = Convert.ToInt32(row["windowHeight"]); } if (row["windowWidth"] != DBNull.Value) { model.windowWidth = Convert.ToInt32(row["windowWidth"]); } if (row["changeWindowHeight"] != DBNull.Value) { model.changeWindowHeight = Convert.ToInt32(row["changeWindowHeight"]); } if (row["changeWindowWidth"] != DBNull.Value) { model.changeWindowWidth = Convert.ToInt32(row["changeWindowWidth"]); } if (row["isAutoAudit"] != DBNull.Value) { model.isAutoAudit = Convert.ToBoolean(row["isAutoAudit"]); } if (row["isDraw"] != DBNull.Value) { model.isDraw = Convert.ToBoolean(row["isDraw"]); } if (row["remark"] != DBNull.Value) { model.remark = Convert.ToString(row["remark"]); } if (row["empNm"] != DBNull.Value) { model.empNm = Convert.ToString(row["empNm"]); } if (row["isReadDesc"] != DBNull.Value) { model.isReadDesc = Convert.ToString(row["isReadDesc"]); } if (row["isEndDesc"] != DBNull.Value) { model.isEndDesc = Convert.ToString(row["isEndDesc"]); } if (row["auditEmpNm"] != DBNull.Value) { model.auditEmpNm = Convert.ToString(row["auditEmpNm"]); } if (row["stepNo"] != DBNull.Value) { model.stepNo = Convert.ToInt32(row["stepNo"]); } if (row["seq"] != DBNull.Value) { model.seq = Convert.ToInt32(row["seq"]); } if (row["isUseEmpDo"] != DBNull.Value) { model.isUseEmpDo = Convert.ToBoolean(row["isUseEmpDo"]); } if (row["isUseEmpLeaderDo"] != DBNull.Value) { model.isUseEmpLeaderDo = Convert.ToBoolean(row["isUseEmpLeaderDo"]); } return model; } else { return null; } }