private void convertHD2Data(int size) { try { int begincode = 0;; if (Session["attachmentconvertbegincode"] != null) { begincode = int.Parse(Session["attachmentconvertbegincode"].ToString()); } RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance(); int i = documentRule.ConvertFileToAttachment(size, ref begincode); if (Session["attachmentconvertcount"] == null) { Session["attachmentconvertcount"] = 0; } Session["attachmentconvertcount"] = int.Parse(Session["attachmentconvertcount"].ToString()) + i; Session["attachmentconvertbegincode"] = begincode; if (i > 0) { Session["attachmentconvertmsg"] = "转换中请等待,已转换" + Session["attachmentconvertcount"].ToString() + "个附件......"; Label1.Text = Session["attachmentconvertmsg"].ToString(); TextBox1.Text = Session["attachmentconvertsize"].ToString(); Response.Write(Rms.Web.JavaScript.Reload(true)); } else { Label1.Text = "转换完成,共转换" + Session["attachmentconvertcount"].ToString() + "个附件."; Session["attachmentconvertsize"] = null; Session["attachmentconvertmsg"] = null; Session["attachmentconvertcount"] = null; Session["attachmentconvertbegincode"] = null; //Response.Write(Rms.Web.JavaScript.Alert(true, "ok")); } } catch (Exception exp) { Session["attachmentconvertsize"] = null; Session["attachmentconvertmsg"] = null; Session["attachmentconvertcount"] = null; Session["attachmentconvertbegincode"] = null; Label1.Text = Label1.Text + " ---- 转换中发生错误,错误信息:<br>" + exp.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { string AttachMentCode = "" + Request["AttachMentCode"]; if (AttachMentCode == "") { return; } if (!Page.IsPostBack) { try { //modi by simon DocumentRule documentRule = DocumentRule.Instance(); documentRule.GetAttachmentByCode(AttachMentCode); Response.Clear(); Response.BufferOutput = true; Response.ContentType = "image/jpeg"; Response.BinaryWrite(documentRule.Content); Response.Flush(); Response.End(); /* * EntityData entity = DAL.EntityDAO.WBSDAO.GetAttachMentByCode(AttachMentCode); * if (entity.HasRecord()) * { * if ( !entity.CurrentRow.IsNull("Content") ) * Response.BinaryWrite((byte[]) entity.CurrentRow["Content"] ); * } * entity.Dispose(); * */ } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "读取图片失败"); } } }
private void convertData2HD(int size) { try { RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance(); LogHelper.WriteLog("TestLog", new Exception("TestLog")); int i = documentRule.ConvertAttachmentToFile(size); if (Session["attachmentconvertcount"] == null) { Session["attachmentconvertcount"] = 0; } Session["attachmentconvertcount"] = (int)Session["attachmentconvertcount"] + i; if (i > 0) { Session["attachmentconvertmsg"] = "转换中请等待,已转换" + Session["attachmentconvertcount"].ToString() + "个附件......"; Label1.Text = Session["attachmentconvertmsg"].ToString(); TextBox1.Text = Session["attachmentconvertsize"].ToString(); Response.Write(Rms.Web.JavaScript.Reload(true)); } else { Label1.Text = "转换完成,共转换" + Session["attachmentconvertcount"].ToString() + "个附件."; Session["attachmentconvertsize"] = null; Session["attachmentconvertmsg"] = null; Session["attachmentconvertcount"] = null; Session["attachmentconvertbegincode"] = null; //Response.Write(Rms.Web.JavaScript.Alert(true, "ok")); } } catch (Exception exp) { Session["attachmentconvertsize"] = null; Session["attachmentconvertmsg"] = null; Session["attachmentconvertcount"] = null; Session["attachmentconvertbegincode"] = null; Label1.Text = Label1.Text + " ---- 转换中发生错误,错误信息:<br>" + exp.ToString(); } }
private void InitPage() { string AttachMentCode = Request.QueryString["AttachMentCode"] + ""; DocumentRule documentRule = DocumentRule.Instance(); new ViewAttachment().OutputAttachment(Response, AttachMentCode, "", documentRule); /* * EntityData entityAttachMent = RemindDAO.GetNoticeAttachMentByCode(AttachMentCode); * DataRow dr = entityAttachMent.CurrentRow; * * * if (dr["Content"].ToString() == "" || dr["Content"] == null) * { * return; * } * * if (dr["Content_Type"].ToString() == "" || dr["Content_Type"] == null) * { * return; * } * * string filename = ""; * * if (dr["filename"] != null) * { * filename = dr["filename"].ToString(); * } * * Response.ContentType = dr["Content_Type"].ToString(); * Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename)); * Response.BinaryWrite((byte[]) dr["Content"]); * Response.Write("window.close();"); * Response.End(); * */ }
private void convertHD2HD(int size) { int begincode = 0;; if (Session["attachmentconvertbegincode"] != null) { begincode = int.Parse(Session["attachmentconvertbegincode"].ToString()); } RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance(); init(); if (_SavePathMode == AttachmentSavePathMode.ROOT) { Label1.Text = "路径选项配置不正确,无法转换"; return; } EntityData entity = new EntityData(); using (SingleEntityDAO dao = new SingleEntityDAO("AttachMent")) { dao.FillEntity("select top " + size.ToString() + " * from attachment where content is null and guidname is not null and attachmentcode>" + begincode + " order by attachmentcode", "", "", entity, "AttachMent"); } DataTable dt = entity.CurrentTable; int count = 0; if (dt.Rows.Count > 0) { Rms.LogHelper.LogHelper.Warn("附件目录转换开始 code>" + begincode.ToString()); try { foreach (DataRow dr in dt.Rows) { DirectoryInfo dir = new DirectoryInfo(GetPath(dr["createdate"].ToString())); if (!dir.Exists) { dir.Create(); } FileInfo file = new FileInfo(Path.Combine(_Path, dr["guidname"].ToString())); if (file.Exists) { file.MoveTo(GetFileName(file.Name, dr["createdate"].ToString())); } else { Rms.LogHelper.LogHelper.Warn("文件未找到" + file.Name); } if (int.Parse(dr["attachmentcode"].ToString()) > begincode) { begincode = int.Parse(dr["attachmentcode"].ToString()); } } Session["attachmentconvertbegincode"] = begincode; Session["attachmentconvertmsg"] = "转换中请等待"; Response.Write(Rms.Web.JavaScript.Reload(true)); } catch (Exception exp) { Rms.LogHelper.LogHelper.Warn("转换错误", exp); Label1.Text = "转换异常中止,请查看错误日志"; } } else { Label1.Text = "转换完成;"; Session["attachmentconvertsize"] = null; Session["attachmentconvertmsg"] = null; Session["attachmentconvertcount"] = null; Session["attachmentconvertbegincode"] = null; } }
/// **************************************************************************** /// <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(); }
private void InitPage() { string AttachMentCode = Request.QueryString["AttachMentCode"] + ""; string Action = Request.QueryString["Action"] + ""; string AttachMent = Request.QueryString["AttachMent"] + ""; DocumentRule documentRule = DocumentRule.Instance(); if (Action.ToLower() == "view") { new ViewAttachment().OutputAttachment(Response, AttachMentCode, AttachMent, documentRule); } if (Action.ToLower() == "del") { try { documentRule.DeleteAttachment(AttachMentCode); } catch (Exception ex) { Rms.LogHelper.LogHelper.Error("删除附件时异常", ex); } Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.AttachMentRefresh();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); } /* * EntityData entityAttachMent = DAL.EntityDAO.AttachmentDAO.GetAttachMentByCode(AttachMentCode); * if(Action=="View") * { * DataRow dr = entityAttachMent.CurrentRow; * * if (dr["Content"].ToString() == "" || dr["Content"] == null) * { * this.lblMessage.Text = "该附件无内容"; * return; * } * * if (dr["Content_Type"].ToString() == "" || dr["Content_Type"] == null) * { * this.lblMessage.Text = "未定义附件的显示方式"; * return; * } * * string filename = ""; * * if (dr["filename"] != null) * { * filename = dr["filename"].ToString(); * } * entityAttachMent.Dispose(); * Response.ContentType = dr["Content_Type"].ToString(); * switch (AttachMent) * { * case "0": * break; * case "1": * Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename)); * break; * default: * //Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename)); * Response.AppendHeader("Content-Disposition", "filename=" + Server.UrlEncode(filename)); * break; * * } * Response.BinaryWrite((byte[]) dr["Content"]); * Response.End(); * }*/ }