/// **************************************************************************** /// <summary> /// 执行 sql 语句将查询结果帮定显示。 /// </summary> /// **************************************************************************** private void LoadData1() { string sql = (string)this.ViewState["SqlString"]; QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("WorkFlowAct", sql); qa.Dispose(); //流程意见 DataColumn Opinion = new DataColumn(); Opinion.ColumnName = "Opinion"; Opinion.DefaultValue = ""; Opinion.DataType = System.Type.GetType("System.String"); //流程同意否决项 DataColumn Opinion1 = new DataColumn(); Opinion1.ColumnName = "OpinionConfirm"; Opinion1.DefaultValue = ""; Opinion1.DataType = System.Type.GetType("System.String"); //增加流程角色名 DataColumn Opinion2 = new DataColumn(); Opinion2.ColumnName = "RoleName"; Opinion2.DefaultValue = ""; Opinion2.DataType = System.Type.GetType("System.String"); //结束 DataColumn Opinion3 = new DataColumn(); Opinion3.ColumnName = "IsEnd"; Opinion3.DefaultValue = "1"; Opinion3.DataType = System.Type.GetType("System.String"); entity.CurrentTable.Columns.Add(Opinion); entity.CurrentTable.Columns.Add(Opinion1); entity.CurrentTable.Columns.Add(Opinion2); entity.CurrentTable.Columns.Add(Opinion3); WorkCase workCase = Rms.WorkFlow.WorkCaseManager.GetWorkCase(this.ViewState["_CaseCode"].ToString()); System.Collections.IDictionaryEnumerator ie = workCase.GetOpinionEnumerator(); string TaskCode = ""; if (this.ActCode != "" && !this.Scout) { Act act = workCase.GetAct(this.ActCode); TaskCode = act.ToTaskCode; } while (ie.MoveNext()) { Opinion Flowopinion = (Opinion)ie.Value; foreach (DataRow dr in entity.CurrentTable.Rows) { //获取当前辅助控制的状态 ModuleState moduleState = this.Toobar.GetModuleState(WorkFlowRule.GetTaskOpinionTypeByActCode(dr["ActCode"].ToString())); //加载意见标题项 Procedure procedure = DefinitionManager.GetProcedureDifinition(dr["ProcedureCode"].ToString(), true); Task task = procedure.GetTask(dr["ToTaskCode"].ToString()); string IsCopy = dr["Copy"].ToString(); //判断是否为结束 if (task.TaskType == 2) { dr["IsEnd"] = "0"; } if (task != null) { if (dr["TaskActorID"].ToString() != "") { TaskActor taskActor = task.GetTaskActor(dr["TaskActorID"].ToString()); if (taskActor.OpinionType + "" != "") { dr["RoleName"] = taskActor.OpinionType + "意见"; } else { Role role = procedure.GetRole(taskActor.ActorCode); if (role != null) { dr["RoleName"] = role.RoleName + "意见"; } } } else { if (task.OpinionType + "" != "") { dr["RoleName"] = task.OpinionType + "意见"; } else { Role role = procedure.GetRole(task.TaskRole); if (role != null) { dr["RoleName"] = role.RoleName + "意见"; } } } } if (dr["ActCode"].ToString() == Flowopinion.ApplicationCode) { //加载同意否决项 this.LoadOpinionConfirm(dr["ApplicationSubject"].ToString(), dr); //加载默认用户 this.LoadImgSign(moduleState, dr["ActUserCode"].ToString(), dr); //当前状态为End时 if (dr["Status"].ToString() == "End") { Act tmpAct = workCase.GetAct(dr["ActCode"].ToString()); // 1为抄送并且公开;2为抄送发起人;3为抄送人自己;4为当前用户拥有监控权限 以上4种情况将允许意见的出现 if (!(tmpAct.Copy == 1 && tmpAct.IsSleep == 0) || (tmpAct.ToTaskCode == TaskCode && tmpAct.FromUserCode == this.UserCode && tmpAct.Copy == 1) || tmpAct.ActUserCode == this.UserCode || this.IsScoutPopedom) { if (moduleState != ModuleState.Sightless && moduleState != ModuleState.Other) { //获取意见项 if (Flowopinion.OpinionText.Length > 0) { //dr["Opinion"] = "<a href=\"#\" OnClick=\"javascript:WorkFlowCaseStateOpenOpinionView('" + Flowopinion.OpinionCode + "');\">" + Flowopinion.OpinionText.Substring(0, 50) + "...</a>"; dr["Opinion"] = Flowopinion.OpinionText.Replace("\n", "<br>") + " "; string tmpstr = DocumentRule.Instance().GetAttachListHtml("WorkFlowActOpinion", tmpAct.ActCode); if (tmpstr != "") { //dr["Opinion"] += " <img src=\"../Images/attach.gif\" style=\"border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none\" /></a><br>" + "附件:" + tmpstr; dr["Opinion"] += "<br>" + "附件:" + tmpstr; } } } } } } } } if (Request["Debug"] + "" == "1") { string procedureCode = entity.GetString("ProcedureCode"); Procedure procedure = DefinitionManager.GetProcedureDifinition(procedureCode, true); /////////////////创建属性表/////////////////// DataTable PropertyTable = RmsPM.BLL.WorkFlowRule.GetPropertyTable(workCase, procedure); this.DataGrid1.DataSource = entity; this.DataGrid1.DataBind(); this.DataGrid2.DataSource = PropertyTable; this.DataGrid2.DataBind(); } DataView dv; if (!((User)Session["user"]).HasOperationRight("090102")) { dv = new DataView(entity.CurrentTable, String.Format(" ActUserCode='{0}' or (FromUserCode='{0}' and Copy='1') or (Copy = '1' and IsSleep='1') or Copy='0'", UserCode), "", DataViewRowState.CurrentRows); } else { dv = new DataView(entity.CurrentTable); } this.DataGrid3.DataSource = dv; this.DataGrid3.DataBind(); foreach (DataRow dr in entity.CurrentTable.Select()) { Act tmpAct = workCase.GetAct(dr["ActCode"].ToString()); if (dr["IsEnd"].ToString() == "0" || tmpAct.Copy == 1) { entity.CurrentTable.Rows.Remove(dr); } } this.DataGrid4.DataSource = entity.CurrentTable; this.DataGrid4.DataBind(); if (dv.Count == 0) { this.Visible = false; } else { this.Visible = true; if (this.ActCode != "" && !this.Scout) { //Act act = workCase.GetAct(this.ActCode); //string TaskCode = act.ToTaskCode; for (int i = 0; i < DataGrid3.Items.Count; i++) { //DataGrid3.Items[i].Cells[10].Text.Trim() == "ActCode" && if (DataGrid3.Items[i].Cells[11].Text.Trim() == TaskCode && DataGrid3.Items[i].Cells[12].Text.Trim() == this.UserCode && DataGrid3.Items[i].Cells[13].Text.Trim() == "1") { Act tmpact = workCase.GetAct(DataGrid3.Items[i].Cells[10].Text.Trim()); ((CheckBox)DataGrid3.Items[i].FindControl("chkopinionshow")).Checked = (tmpact.IsSleep == 1); ((CheckBox)DataGrid3.Items[i].FindControl("chkopinionshow")).Visible = true; } else { ((CheckBox)DataGrid3.Items[i].FindControl("chkopinionshow")).Visible = false; Act tmpact = workCase.GetAct(DataGrid3.Items[i].Cells[10].Text.Trim()); if (tmpact.IsSleep == 1 && tmpact.Copy == 1) { DataGrid3.Items[i].Cells[9].Text = " √"; } else if (tmpact.IsSleep == 0 && tmpact.Copy == 1) { DataGrid3.Items[i].Cells[9].Text = " x"; } } } } if (this.Scout) { for (int i = 0; i < DataGrid3.Items.Count; i++) { ((CheckBox)DataGrid3.Items[i].FindControl("chkopinionshow")).Visible = false; Act tmpact = workCase.GetAct(DataGrid3.Items[i].Cells[10].Text.Trim()); if (tmpact.IsSleep == 1 && tmpact.Copy == 1) { DataGrid3.Items[i].Cells[9].Text = " √"; } else if (tmpact.IsSleep == 0 && tmpact.Copy == 1) { DataGrid3.Items[i].Cells[9].Text = " x"; } } } } entity.Dispose(); }
/// **************************************************************************** /// <summary> /// 执行 sql 语句将查询结果帮定显示。 /// </summary> /// **************************************************************************** private void LoadData() { string sql = (string)this.ViewState["SqlString"]; QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("WorkFlowAct", sql); qa.Dispose(); DataColumn Opinion = new DataColumn(); Opinion.ColumnName = "Opinion"; Opinion.DefaultValue = ""; Opinion.DataType = System.Type.GetType("System.String"); entity.CurrentTable.Columns.Add(Opinion); WorkCase workCase = Rms.WorkFlow.WorkCaseManager.GetWorkCase(this.ViewState["_CaseCode"].ToString()); System.Collections.IDictionaryEnumerator ie = workCase.GetOpinionEnumerator(); string TaskCode = ""; if (this.ActCode != "" && !this.Scout) { Act act = workCase.GetAct(this.ActCode); TaskCode = act.ToTaskCode; } while (ie.MoveNext()) { Opinion Flowopinion = (Opinion)ie.Value; foreach (DataRow dr in entity.CurrentTable.Rows) { if (dr["ActCode"].ToString() == Flowopinion.ApplicationCode) { if (dr["Status"].ToString() == "End") { Act tmpAct = workCase.GetAct(dr["ActCode"].ToString()); if (!(tmpAct.Copy == 1 && tmpAct.IsSleep == 0) || (tmpAct.ToTaskCode == TaskCode && tmpAct.FromUserCode == this.UserCode && tmpAct.Copy == 1) || tmpAct.ActUserCode == this.UserCode || this.IsScoutPopedom) { if (Flowopinion.OpinionText.Length > 0) { ModuleState moduleState = this.Toobar.GetModuleState(WorkFlowRule.GetTaskOpinionTypeByActCode(dr["ActCode"].ToString())); if (moduleState != ModuleState.Sightless && moduleState != ModuleState.Other) { //dr["Opinion"] = "<a href=\"#\" OnClick=\"javascript:WorkFlowCaseStateOpenOpinionView('" + Flowopinion.OpinionCode + "');\">" + Flowopinion.OpinionText.Substring(0, 50) + "...</a>"; dr["Opinion"] = Flowopinion.OpinionText.Replace("\n", "<br>") + " <a href=\"#\" OnClick=\"javascript:WorkFlowCaseStateOpenOpinionView('" + Flowopinion.OpinionCode + "');return false;\">[详细]"; string tmpstr = DocumentRule.Instance().GetAttachListHtml("WorkFlowActOpinion", tmpAct.ActCode); if (tmpstr != "") { //dr["Opinion"] += " <img src=\"../Images/attach.gif\" style=\"border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none\" /></a><br>" + "附件:" + tmpstr; dr["Opinion"] += "</a><br>" + "附件:" + tmpstr; } else { dr["Opinion"] += "</a>"; } } } } } } } } if (Request["Debug"] + "" == "1") { string procedureCode = entity.GetString("ProcedureCode"); Procedure procedure = DefinitionManager.GetProcedureDifinition(procedureCode, true); /////////////////创建属性表/////////////////// DataTable PropertyTable = RmsPM.BLL.WorkFlowRule.GetPropertyTable(workCase, procedure); this.DataGrid1.DataSource = entity; this.DataGrid1.DataBind(); this.DataGrid2.DataSource = PropertyTable; this.DataGrid2.DataBind(); } DataView dv; if (!((User)Session["user"]).HasOperationRight("090102")) { dv = new DataView(entity.CurrentTable, String.Format(" ActUserCode='{0}' or (FromUserCode='{0}' and Copy='1') or (Copy = '1' and IsSleep='1') or Copy='0'", UserCode), "", DataViewRowState.CurrentRows); } else { dv = new DataView(entity.CurrentTable); } this.dgList.DataSource = dv; this.dgList.DataBind(); if (dv.Count == 0) { this.Visible = false; } else { this.Visible = true; if (this.ActCode != "" && !this.Scout) { //Act act = workCase.GetAct(this.ActCode); //string TaskCode = act.ToTaskCode; for (int i = 0; i < dgList.Items.Count; i++) { //dgList.Items[i].Cells[10].Text.Trim() == "ActCode" && if (dgList.Items[i].Cells[8].Text.Trim() == TaskCode && dgList.Items[i].Cells[9].Text.Trim() == this.UserCode && dgList.Items[i].Cells[10].Text.Trim() == "1") { Act tmpact = workCase.GetAct(dgList.Items[i].Cells[7].Text.Trim()); ((CheckBox)dgList.Items[i].FindControl("chkopinionshow")).Checked = (tmpact.IsSleep == 1); ((CheckBox)dgList.Items[i].FindControl("chkopinionshow")).Visible = true; } else { ((CheckBox)dgList.Items[i].FindControl("chkopinionshow")).Visible = false; Act tmpact = workCase.GetAct(dgList.Items[i].Cells[7].Text.Trim()); if (tmpact.IsSleep == 1 && tmpact.Copy == 1) { dgList.Items[i].Cells[6].Text = " 公开"; } else if (tmpact.IsSleep == 0 && tmpact.Copy == 1) { dgList.Items[i].Cells[6].Text = " 未公开"; } } } } if (this.Scout) { for (int i = 0; i < dgList.Items.Count; i++) { ((CheckBox)dgList.Items[i].FindControl("chkopinionshow")).Visible = false; Act tmpact = workCase.GetAct(dgList.Items[i].Cells[7].Text.Trim()); if (tmpact.IsSleep == 1 && tmpact.Copy == 1) { dgList.Items[i].Cells[6].Text = " 公开"; } else if (tmpact.IsSleep == 0 && tmpact.Copy == 1) { dgList.Items[i].Cells[6].Text = " 未公开"; } } } } entity.Dispose(); }