public void ToBool_ValueEmpty() { string str = string.Empty; Boolean?value = ConvertEx.ToBool(str); Assert.AreEqual(value, false); }
protected void rpData_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView view = e.Item.DataItem as DataRowView; Literal ltCheckStatus = e.Item.FindControl("ltCheckStatus") as Literal; Literal ltRemark = e.Item.FindControl("ltRemark") as Literal; Hashtable ht = new Hashtable(); ht.Add("SingleProjectID", singleProjectID); ht.Add("WorkFlowID", workFlowID); ht.Add("ArchiveID", view["ArchiveID"].ToString()); List <T_WorkFlowDoResult_MDL> list = doResultBLL.GetArchiveLastChecResultList(ht); //获取的是最后一次的审核信息,根据流程ID if (list.Count > 0) { string remark = list[0].DoRemark.ToString(); bool blDoResult = ConvertEx.ToBool(list[0].DoResult); ltCheckStatus.Text = PublicModel.GetImageforStatus(blDoResult); ltRemark.Text = "<a style=\"color: black;cursor:pointer;\" onclick=\"Common.fnLayerTips('" + remark + "',this)\"> "; ltRemark.Text += ((remark.Length > 3) ? remark.Substring(0, 3) + "..." : remark) + "</a>"; HtmlTableRow col = (HtmlTableRow)e.Item.FindControl("r1"); if (blDoResult) { col.BgColor = "green"; } else { col.BgColor = "red"; } } } }
public void ToBool_ValueIsYes() { string str = "yes"; Boolean?value = ConvertEx.ToBool(str); Assert.AreEqual(value, true); }
public void ToBool_ValueTrue() { string str = "true"; Boolean?value = ConvertEx.ToBool(str); Assert.AreEqual(value, true); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { T_FileList_BLL fileListBLL = new T_FileList_BLL(); T_WorkFlowDoResult_BLL doResultBLL = new T_WorkFlowDoResult_BLL(); string[] FileListIDS = DNTRequest.GetQueryString("FileListIDS").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] MustSubmitFlags = DNTRequest.GetQueryString("mustSubmitFlags").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < FileListIDS.Length; i++) { T_FileList_MDL fileListMDL = fileListBLL.GetModel(ConvertEx.ToInt(FileListIDS[i])); if (fileListMDL != null && !fileListMDL.IsFolder) { T_WorkFlowDoResult_MDL doResultMDL = new T_WorkFlowDoResult_MDL(); doResultMDL.FileListID = ConvertEx.ToInt(FileListIDS[i]); doResultMDL.SingleProjectID = DNTRequest.GetQueryInt("SingleProjectID", 0); doResultMDL.WorkFlowID = DNTRequest.GetQueryInt("workFlowID", 0); doResultMDL.DoUserID = Common.ConvertEx.ToInt(Common.Session.GetSessionInt("UserID")); doResultMDL.DoDateTime = System.DateTime.Now; doResultMDL.DoResult = ddlDoResult.SelectedValue; doResultMDL.DoRemark = DoRemark.Text.Trim(); doResultBLL.Add(doResultMDL); fileListMDL.Remark = DoRemark.Text.Trim(); fileListMDL.MustSubmitFlag = ConvertEx.ToBool(MustSubmitFlags[i]); fileListBLL.Update(fileListMDL); FileAccept(FileListIDS[i], ConvertEx.ToBool(ddlDoResult.SelectedValue)); } } Common.MessageBox.CloseLayerOpenWeb(this.Page); }
protected void Page_Load(object sender, EventArgs e) { Ajax.Utility.RegisterTypeForAjax(typeof(FileListTmpList)); MyAddInit(); archive_form_no.MyArchiveTypeChanged += new DigiPower.Onlinecol.Standard.Web.CommonCtrl. ctrlArchiveFormType.ArchiveTypeChanged(archive_form_no_MyArchiveTypeChanged); if (!IsPostBack) { archive_form_no.DataBindEx(); PID.DataBindEx(0, archive_form_no.SelectValue, "BH"); if (!String.IsNullOrWhiteSpace(DNTRequest.GetQueryString("archive_form_no"))) { archive_form_no.SelectValue = Server.UrlDecode(DNTRequest.GetQueryString("archive_form_no")); } if (!String.IsNullOrWhiteSpace(DNTRequest.GetQueryString("Title"))) { txtTitle.Text = Server.UrlDecode(DNTRequest.GetQueryString("Title")); } if (!String.IsNullOrWhiteSpace(DNTRequest.GetQueryString("PID"))) { PID.SelectValue = Server.UrlDecode(DNTRequest.GetQueryString("PID").ToUpper()); } if (!String.IsNullOrWhiteSpace(DNTRequest.GetQueryString("SignatureType"))) { chkSignature.Checked = ConvertEx.ToBool(DNTRequest.GetQueryInt("SignatureType", 0)); } BindGridView(AspNetPager.CurrentPageIndex); } }
public void ToBool_ValueNotConvertible() { string str = "abc"; Boolean?value = ConvertEx.ToBool(str); Assert.IsNull(value); }
public void ToBool_ValueIsMinusOne() { string str = "-1"; Boolean?value = ConvertEx.ToBool(str); Assert.AreEqual(value, true); }
public void ToBool_ValueN() { string str = "n"; Boolean?value = ConvertEx.ToBool(str); Assert.AreEqual(value, false); }
public string getShowText(object isFolder, string html) { if (!ConvertEx.ToBool(isFolder)) { return(html); } else { return(""); } }
public string SetTextDisabled(object isFolder) { if (ConvertEx.ToBool(isFolder)) { return(" disabled='disabled' "); } else { return(""); } }
public string SetTextDisabled(object isFolder) { if (ConvertEx.ToBool(isFolder)) { return(" disabled='disabled' style='border:solid 0px;' "); } else { return(""); } }
public string SetCheckBox(object flag) { if (ConvertEx.ToBool(flag)) { return(" checked='checked' "); } else { return(""); } }
public void UpdateFile(string fileListID, string remark, string mustSubmitFlag) { T_FileList_MDL fileMDL = fileListBLL.GetModel(ConvertEx.ToInt(fileListID)); if (fileMDL != null) { fileMDL.Remark = remark; fileMDL.MustSubmitFlag = ConvertEx.ToBool(mustSubmitFlag); fileListBLL.Update(fileMDL); } }
/// <summary> /// 根据文件 isFolder 显示返回的Input html /// </summary> /// <param name="isFolder"></param> /// <param name="value"></param> /// <param name="maxlength"></param> /// <param name="jsHtml"></param> /// <returns></returns> public string getInputTextForIsFolder(object isFolder, object value, string maxlength, string jsHtml) { if (ConvertEx.ToBool(isFolder)) { return("<input type=\"text\" title=\"" + value.ToString() + "\" value=\"" + value.ToString() + "\" class=\"regedit_input\" disabled=\"disabled\" />"); } else { return("<input type=\"text\" title=\"" + value.ToString() + "\" value=\"" + value.ToString() + "\"" + "class=\"regedit_input\" maxlength=\"" + maxlength + "\" " + jsHtml + "/>"); } }
/// <summary> /// 格式化电子文件图标,文件级 /// </summary> /// <param name="isFolder">是否是目录级</param> /// <param name="bh">文件编号</param> /// <param name="fileListID">文件id</param> public string getEfileImage(object isFolder, string bh, string fileListID) { string strImage = " <img extFile=\"0\" style=\"cursor:pointer; border:0px; color:white;\" onclick=\"lookPDF(0,'" + bh + "'," + fileListID + ")\" src=\"../Javascript/Layer/image/JPG.png\" alt=\"无文件\" />"; if ((ConvertEx.ToBool(isFolder) && fileListBLL.GetFileCountByPID(ConvertEx.ToInt(fileListID)) > 0 && bh.Length > 1) || !(ConvertEx.ToBool(isFolder))) { strImage = " <img extFile=\"0\" style=\"cursor:pointer;border:0px; color:white;\" onclick=\"lookPDF(1,'" + bh + "'," + fileListID + ")\" src=\"../Javascript/Layer/image/JPG_1.png\" alt=\"点击查看\" />"; } return(strImage); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { System.Drawing.Color col = System.Drawing.Color.White; DataRowView view = e.Row.DataItem as DataRowView; int status = ConvertEx.ToInt(view["SIGNATURE_FLAG"]); CBLL.ColorList colorList = new ColorList(); col = colorList.GetMyColor((status * 10).ToString()); e.Row.BackColor = col; for (int i = 0; i < e.Row.Cells.Count; i++) { if (!ConvertEx.ToBool(view["IsFolder"])) { e.Row.Cells[i].BackColor = col; } } if (Common.ConvertEx.ToBool(view["IsFolder"])) { for (int i = 1; i < e.Row.Cells.Count; i++) { foreach (Control control in e.Row.Cells[i].Controls) //禁用文件节点 { if (control is HtmlControl) { if (control is HtmlInputText) { ((HtmlInputText)control).Attributes.Add("style", "border:solid 0px"); } ((HtmlControl)control).Disabled = true; } if (control is WebControl) { if (control is TextBox) { ((TextBox)control).Attributes.Add("style", "border:solid 0px"); } ((WebControl)control).Enabled = false; } } } } } }
/// <summary> /// 根据文件 isFolder 显示返回的Input html /// </summary> /// <param name="isFolder"></param> /// <param name="value"></param> /// <param name="maxlength"></param> /// <param name="jsHtml"></param> /// <returns></returns> public string getInputTextForIsFolder(object isFolder, object value, string maxlength, string jsHtml) { if (ConvertEx.ToBool(isFolder)) { return("<input type=\"text\" title=\"" + value.ToString() + "\" value=\"" + value.ToString() + "\" class=\"regedit_input\" disabled=\"disabled\" />"); } else { return("<input type=\"text\" title=\"" + value.ToString() + "\" value=\"" + value.ToString() + "\"" + "class=\"regedit_input\" maxlength=\"" + maxlength + "\" " + jsHtml + "/>"); } //<img style="cursor: pointer;" onclick="lookPDF('<%# Eval("BH")%>',<%# Eval("FileListID")%>)" // src="../Javascript/Layer/image/EFILE_1.png" alt="点击查看" /> }
public void SetFileListSignatureStatus(string fileListID, string iSignaturePdf, string iSignatureWorkFlow) { try { //注意:如果文件已开始顺签,后又混签,则没影响; 如果先混签,在设置为顺签,则有影响. 看是否需要过滤下如果文件已开始签章则不能更改 (是否按签章流程签章)标识 T_FileList_MDL fileListMDL = fileListBLL.GetModel(ConvertEx.ToInt(fileListID)); if (fileListMDL != null) { fileListMDL.iSignaturePdf = ConvertEx.ToBool(iSignaturePdf); fileListMDL.iSignatureWorkFlow = ConvertEx.ToBool(iSignatureWorkFlow); fileListBLL.Update(fileListMDL); PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_FileList;key=", fileListMDL.FileListID, ";SingleProjectID=", fileListMDL.SingleProjectID, ";bh=", fileListMDL.BH, ";iSignaturePdf=", iSignaturePdf, ";iSignatureWorkFlow=", iSignatureWorkFlow, ";Title=", fileListMDL.Title, ";文件登记页更新是否需要签章,是否按流程签章")); } } catch (Exception ex) { LogUtil.Debug(this, "文件登记归档目录保存操作", ex); } }
private static object DebugSqlValue(SqlParameter param) { var val = param.Value; if (val == null) { return("NULL"); } if (val == DBNull.Value) { return("NULL"); } switch (param.SqlDbType) { case SqlDbType.Char: case SqlDbType.Text: case SqlDbType.Time: case SqlDbType.VarChar: case SqlDbType.Xml: case SqlDbType.Date: case SqlDbType.DateTime: case SqlDbType.DateTime2: case SqlDbType.DateTimeOffset: return(val); // $"'{val.ToString().Replace("'", "''")}'"; case SqlDbType.NChar: case SqlDbType.NText: case SqlDbType.NVarChar: return($"N'{val.ToString().Replace("'", "''")}'"); case SqlDbType.Binary: case SqlDbType.VarBinary: var bytes = val as IEnumerable <byte>; return($"0x{bytes.ToHex()}"); case SqlDbType.Bit: return(ConvertEx.ToBool(val) ? "1" : "0"); default: return(val.ToString()); } }
public string HookUpCompanyAndUser(int SingleProjectID, int UserID, int RoleID, int CompanyID, string ProjectType, string UserName, string CompanyType) { string flag = SystemSet._RETURN_SUCCESS_VALUE; try { string iSignaturePdf = "0"; //文件是否需要签章 string iSignatureWorkFlow = "0"; //是否按签章流程签章 if (ConvertEx.ToBool(SystemSet._ISIGNATUREPDF)) { iSignaturePdf = "1"; iSignatureWorkFlow = "1"; } PublicModel.AddSingleProjectUser(SingleProjectID, RoleID, UserID); //加入到工程用户表中去 PublicModel.AddSingleProjectCompany(SingleProjectID, CompanyID); //加入到工程公司表中去 userOper.CopyFileList(CompanyID, UserID, UserName, SingleProjectID, ProjectType, CompanyType, iSignaturePdf, iSignatureWorkFlow); //用户添加归档目录 #region 关联更新工程表的 施工,监理单位信息 T_SingleProject_MDL singleMDL = singleBLL.GetModel(SingleProjectID); T_Company_MDL companyMDL = companyBLL.GetModel(CompanyID); if (singleMDL != null && companyMDL != null) { if (ConvertEx.ToInt(CompanyType) == SystemSet._SGCOMPANYINFO) { singleMDL.sgdw = companyMDL.CompanyName; } else if (ConvertEx.ToInt(CompanyType) == SystemSet._JLCOMPANYINFO) { singleMDL.jldw = companyMDL.CompanyName; } singleBLL.Update(singleMDL); } #endregion } catch (Exception ex) { flag = SystemSet._RETURN_FAILURE_VALUE + ex.Message; Common.LogUtil.Debug(this, "工程相关表关联(工程用户表,工程公司表)", ex); } return(flag); }
public string AllotSingleProject(string SingleProjectID, string ChargeUserID, string WorkFlowID) { try { //激活工程 T_SingleProject_MDL singleProjectMDL = singleProjectBLL.GetModel(ConvertEx.ToInt(SingleProjectID)); singleProjectMDL.Status = 1; int CompanyID = 0; #region 没有工程编号则生成 if (String.IsNullOrEmpty(singleProjectMDL.gcbm)) { T_Other_BLL otherBLL = new T_Other_BLL(); singleProjectMDL.gcbm = otherBLL.GetNewEngineerID(); singleProjectBLL.Update(singleProjectMDL); //产生工程号 T_Construction_Project_BLL cpBLL = new T_Construction_Project_BLL(); Model.T_Construction_Project_MDL cpMDL = cpBLL.GetModel(singleProjectMDL.ConstructionProjectID); if (cpMDL != null) { CompanyID = cpMDL.CompanyID; //建设单位ID if (String.IsNullOrEmpty(cpMDL.xmh)) { cpMDL.xmh = otherBLL.GetNewProjectID(); cpBLL.Update(cpMDL); //更新项目号 } } } #endregion #region 激活用户 T_UsersInfo_BLL userBLL = new T_UsersInfo_BLL(); T_UsersInfo_MDL userMDL = userBLL.GetModel(singleProjectMDL.CompanyUserID); if (userMDL != null) { userMDL.IsValid = true; userBLL.Update(userMDL); } #endregion #region 修改工程分配信息 if (singleProjectMDL != null) { singleProjectMDL.AllotDate = DateTime.Now; //分配时间 singleProjectMDL.AllotUserID = ConvertEx.ToInt(Common.Session.GetSession("UserId")); //分配人员 singleProjectMDL.ChargeUserID = ConvertEx.ToInt(ChargeUserID); //业务指导人员 singleProjectBLL.Update(singleProjectMDL); } #endregion #region 添加建设单位归档目录 string iSignaturePdf = "0"; //文件是否需要签章 string iSignatureWorkFlow = "0"; //是否按签章流程签章 if (ConvertEx.ToBool(SystemSet._ISIGNATUREPDF)) { iSignaturePdf = "1"; iSignatureWorkFlow = "1"; } new UserOperate().CopyFileList(CompanyID, singleProjectMDL.CompanyUserID, "", singleProjectMDL.SingleProjectID, singleProjectMDL.ProjectType, iSignaturePdf, iSignatureWorkFlow); #endregion #region 把业务指导人员用户加入到这个工程用户中去 T_UsersInfo_MDL ChargeUserMDL = userBLL.GetModel(Common.ConvertEx.ToInt(ChargeUserID)); PublicModel.AddSingleProjectUser(singleProjectMDL.SingleProjectID, ChargeUserMDL); #endregion #region 相关流程的用户也需要加入,否则流程走不下去===现在有了受理,可以达到这个功能,不需要加了。让用户受理下来。受理还没做完呢? SingleProjectUser projectRole = new SingleProjectUser(); BLL.T_WorkFlow_BLL workFlowBLL = new T_WorkFlow_BLL(); DataSet workFlowDS = workFlowBLL.GetList(" OrderIndex=1 "); if (workFlowDS.Tables.Count > 0) { foreach (DataRow row in workFlowDS.Tables[0].Rows) { projectRole.Update(singleProjectMDL.SingleProjectID, Common.ConvertEx.ToInt(row["RoleID"]), Common.ConvertEx.ToInt(row["UserID"])); } } #endregion #region 发送邮件通知客户 if (SystemSet._ACCEPTSINGLE_SENDEMAILFLAG) { string strMsgBody = "您好!<br />"; strMsgBody += "您报建的工程:" + singleProjectMDL.gcmc + ",已确认通过,产生的工程编号是:" + singleProjectMDL.gcbm + ",您现在已经可以通过注册时的账号密码登记系统操作了!"; T_UsersInfo_MDL CompanyUserMDL = userBLL.GetModel(singleProjectMDL.CompanyUserID); Common.CSendEmail.SendEmail("档案馆", CompanyUserMDL.EMail, "工程报建确认通知", strMsgBody, ""); } #endregion #region 提交到下一个流程 WorkFlowManage workflowmanage = new WorkFlowManage(); workflowmanage.GoNextProjectWorkFlowSataus(singleProjectMDL.SingleProjectID, ConvertEx.ToInt(WorkFlowID)); #endregion #region 将指导人员指导环节的所有 [受理]全部 做,这样,除了管理员和受理人员外,其他人都看不到流程下的工程 T_WorkFlowDefine_BLL workFlowDefineBLL = new T_WorkFlowDefine_BLL(); IList <T_WorkFlowDefine_MDL> workFlowDefineLT = workFlowDefineBLL.GetModelList(" SingleProjectID=" + singleProjectMDL.SingleProjectID + " and WorkFlowID in(" + SystemSet._DEFAULT_RECV_WORKFLOWID + ") "); if (workFlowDefineLT != null && workFlowDefineLT.Count > 0) { foreach (T_WorkFlowDefine_MDL wkdMDL in workFlowDefineLT) { wkdMDL.SubmitStatus = 2;//受理完成状态 wkdMDL.RecvUserID = Common.ConvertEx.ToInt(ChargeUserID); wkdMDL.RecvDateTime = DateTime.Now; workFlowDefineBLL.Update(wkdMDL); } } #endregion return(singleProjectMDL.gcbm); } catch (Exception ex) { return(SystemSet._RETURN_FAILURE_VALUE + ex.Message); } }
/// <summary> /// Flag=2表示按所选节点组卷,1,自动组卷,3加入到指定案卷 /// </summary> /// <param name="flag"></param> /// <param name="selId"></param> private void DoZJ(string flag, string selId) { string strWhere = "SingleProjectID=" + singleProjectID + "and status<>100"; if (flag == "2" || flag == "3") { strWhere += " and FileListID in (" + selId + ")"; } DataSet dsFileList = fileListBLL.GetList(strWhere); int ArchiveID = 0; int ManualCountTotal = 0; if (flag == "3") { if (TreeView2.Nodes[0].ChildNodes.Count > 0) { foreach (TreeNode tNode in TreeView2.Nodes[0].ChildNodes) { if (tNode.Checked)//选中案卷 { int tArchiveID = Common.ConvertEx.ToInt(tNode.Value.ToString()); Model.T_Archive_MDL acMDL = archiveBLL.GetModel(tArchiveID); if (acMDL != null) { ArchiveID = acMDL.ArchiveID; ManualCountTotal = acMDL.sl; } } } if (ArchiveID == 0) { MessageBox.Show(this, "请勾选右边的需加入的案卷!"); return; } } else { MessageBox.Show(this, "请勾选右边的需加入的案卷!"); return; } } if (dsFileList.Tables.Count > 0 && dsFileList.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsFileList.Tables[0].Rows.Count; i++) { string bIsFolder = dsFileList.Tables[0].Rows[i]["IsFolder"].ToString(); //为目录的数据不处理,跳到下一条 if (ConvertEx.ToBool(bIsFolder)) { continue; } else { int ManualCount = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["ManualCount"].ToString()); int FileListID = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["FileListID"].ToString()); if (ArchiveID == 0) //在这里创建案卷 { ArchiveID = CreateAj(); } Model.T_FileList_MDL flMDL = fileListBLL.GetModel(FileListID); flMDL.ArchiveID = ConvertEx.ToInt(ArchiveID); flMDL.OldStatus = flMDL.Status; flMDL.Status = "100"; fileListBLL.Update(flMDL); } } if (ArchiveID > 0) { Model.T_Archive_MDL acMDL = archiveBLL.GetModel(ArchiveID); acMDL.sl = ManualCountTotal; archiveBLL.Update(acMDL); } } }
//绑定归档目录 private void BindGridView(int pageIndex) { T_SingleProject_MDL spMDL = spBLL.GetModel(Common.ConvertEx.ToInt(singleProjectID)); if (spMDL != null) { singleProjectNo = spMDL.gcbm; projecttype = spMDL.ProjectType; //取当前工程的所有归档目录 string strWhere = " SingleProjectID=" + singleProjectID; //不显示声像节点 //jdk 2014.11.16 strWhere += " AND BH not like '%S%' "; if (PublicModel.isCompany() && !PublicModel.isLeader()) //监理或施工只能看到自己的 { strWhere += " and operateuserid=" + Common.Session.GetSession("UserID"); } if (ConvertEx.ToBool(SystemSet._ISIGNATUREPDF)) { if (!string.IsNullOrWhiteSpace(ddliSignaturePdf.SelectedValue)) { strWhere += " AND iSignaturePdf=" + ddliSignaturePdf.SelectedValue + ""; //是否需要签章 } if (!string.IsNullOrWhiteSpace(ddlSignatureFinishFlag.SelectedValue)) //签章完成状态 { string tempStrWhere = " and iSignaturePdf=1 and IsFolder=0 and (SELECT COUNT(1) from T_FileList_SignatureTmp f1 where f1.FileListID=T_FileList.OldRecID)>0 "; int signatureFinishFlag = ConvertEx.ToInt(ddlSignatureFinishFlag.SelectedValue); //签章是否完成标记 那已签章完成的记录跟需要签章的记录比对. if (signatureFinishFlag == 1) //签章完成 { tempStrWhere += "and (SELECT COUNT(1) from T_FileList_SignatureLog f0 where f0.FileListID=T_FileList.FileListID and f0.SignatureFinishFlag=1)"; tempStrWhere += ">=(SELECT COUNT(1) from T_FileList_SignatureTmp f1 where f1.FileListID=T_FileList.OldRecID) "; strWhere += tempStrWhere; } else if (signatureFinishFlag == 0) //签章未完成 { tempStrWhere += "and (SELECT COUNT(1) from T_FileList_SignatureLog f0 where f0.FileListID=T_FileList.FileListID and f0.SignatureFinishFlag=1)"; tempStrWhere += "<(SELECT COUNT(1) from T_FileList_SignatureTmp f1 where f1.FileListID=T_FileList.OldRecID) "; strWhere += tempStrWhere; } } } if (!String.IsNullOrWhiteSpace(txtMyCode.Text.Trim())) { strWhere += " AND MyCode LIKE '%" + txtMyCode.Text.Trim() + "%'"; } if (!String.IsNullOrWhiteSpace(txtTitle.Text.Trim())) { strWhere += " AND TITLE LIKE '%" + txtTitle.Text.Trim() + "%'"; } if (!String.IsNullOrWhiteSpace(rdbFileStatus.SelectValue) && rdbFileStatus.SelectValue != "0") { strWhere += " AND Status=" + rdbFileStatus.SelectValue; } if (!String.IsNullOrWhiteSpace(ddlCompany.SelectValue) && ddlCompany.SelectValue != "0") { T_Company_BLL compBLL = new T_Company_BLL(); T_Company_MDL compMDL = compBLL.GetModel(ConvertEx.ToInt(ddlCompany.SelectValue)); if (compMDL != null) { strWhere += " AND DefaultCompanyType=" + compMDL.CompanyType + ""; } } if (!String.IsNullOrWhiteSpace(ddlFileType.SelectValue) && ddlFileType.SelectValue != "0") { strWhere += " AND BH like '" + ddlFileType.SelectValue + "%' "; } Session["FileInfostrWhere"] = strWhere; if (ViewState["CurrentPageIndex"] == null && Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex")) > 0) { pageIndex = Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex")); ViewState["CurrentPageIndex"] = pageIndex; } else { pageIndex = ConvertEx.ToInt(ViewState["CurrentPageIndex"]); } DataTable dt = fileListBLL.GetListPaging(strWhere, pageSize, pageIndex, out itemCount);; AspNetPager.AlwaysShow = true; AspNetPager.PageSize = pageSize; AspNetPager.RecordCount = itemCount; AspNetPager.CurrentPageIndex = pageIndex; rpData.DataSource = dt; rpData.DataBind(); } }
public string ExctFileList(string strIsFolder, string strFileListID, string strSingleProjectId, string strTitle, string strZRR, string strWTH, string strStartTime, string strManualCount, string strBH, string strPID, string myCode, string DefaultCompanyType, string strOldRecID) { string ReturnValue = "0"; try { T_FileList_BLL Bll = new T_FileList_BLL(); T_FileList_MDL Mdl = new T_FileList_MDL(); int FileListId = ConvertEx.ToInt(strFileListID); string SingleProjectId = strSingleProjectId; if (FileListId > 0) { Mdl = Bll.GetModel(FileListId); } else { Mdl.PID = ConvertEx.ToInt(strPID); Mdl.DefaultCompanyType = ConvertEx.ToInt(DefaultCompanyType); Mdl.CompanyID = ConvertEx.ToInt(Common.Session.GetSession("CompanyID")); Mdl.OperateUserID = ConvertEx.ToInt(Common.Session.GetSession("UserID")); Mdl.recID = Bll.GetMaxRecID(SingleProjectId); Mdl.IsSystem = false; Mdl.BH = strBH; Mdl.IsFolder = ConvertEx.ToBool(strIsFolder); Mdl.PagesCount = 0; //上传页数默认为0 Mdl.OrderIndex = 0; //文件序号默认为0,组完卷,根据文件编号自动生成序号 } Mdl.OldRecID = ConvertEx.ToInt(strOldRecID);//归档目录模板ID不能变,以后用户签章,模板ID关联签章流程 Mdl.shr_3 = "0"; Mdl.w_t_h = strWTH; Mdl.SingleProjectID = ConvertEx.ToInt(SingleProjectId); Mdl.zrr = strZRR; Mdl.Title = strTitle; Mdl.ManualCount = ConvertEx.ToInt(strManualCount); Mdl.MyCode = myCode; Mdl.CreateDate = DateTime.Now; //文件登记时间 Mdl.Version = PublicModel.getFileVersion(SingleProjectId); //获取文件的版本号 if (strStartTime != null && strStartTime.Trim().Length > 0) { Mdl.StartTime = ConvertEx.ToDate(strStartTime).ToString("yyyy-MM-dd"); } if (FileListId > 0 && !Mdl.IsFolder) { Bll.Update(Mdl); PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_FileList;key=", Mdl.FileListID, ";SingleProjectID=", Mdl.SingleProjectID, ";bh=", Mdl.BH, ";Title=", Mdl.Title)); //更改已登记状态 BLL.T_Other_BLL otherBLL = new BLL.T_Other_BLL(); otherBLL.UpdateArchiveStatus(FileListId.ToString(), 10); } else { FileListId = Bll.Add(Mdl); PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_FileList;key=", FileListId, ";SingleProjectID=", Mdl.SingleProjectID, ";bh=", Mdl.BH, ";Title=", Mdl.Title)); } ReturnValue = FileListId.ToString(); } catch (Exception ex) { LogUtil.Debug(this, "文件登记归档目录保存操作", ex); } return(ReturnValue); }
/// <summary> /// Flag=2表示按所选节点组卷,1,自动组卷,3加入到指定案卷 /// </summary> /// <param name="flag"></param> /// <param name="selId"></param> private void DoZJ(string flag, string selId) { string strWhere = "SingleProjectID=" + singleProjectID + "and status<>100"; if (flag == "2" || flag == "3") { strWhere += " and FileListID in (" + selId + ")"; } DataSet dsFileList = fileListBLL.GetList(strWhere); int ArchiveID = 0; int ManualCountTotal = 0; if (flag == "3") { if (TreeView2.Nodes[0].ChildNodes.Count > 0) { foreach (TreeNode tNode in TreeView2.Nodes[0].ChildNodes) { if (tNode.Checked)//选中案卷 { int tArchiveID = Common.ConvertEx.ToInt(tNode.Value.ToString()); Model.T_Archive_MDL acMDL = archiveBLL.GetModel(tArchiveID); if (acMDL != null) { ArchiveID = acMDL.ArchiveID; ManualCountTotal = acMDL.sl; } } } if (ArchiveID == 0) { MessageBox.Show(this, "请勾选右边的需加入的案卷!"); return; } } else { MessageBox.Show(this, "请勾选右边的需加入的案卷!"); return; } } if (dsFileList.Tables.Count > 0 && dsFileList.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsFileList.Tables[0].Rows.Count; i++) { string bIsFolder = dsFileList.Tables[0].Rows[i]["IsFolder"].ToString(); //为目录的数据不处理,跳到下一条 if (ConvertEx.ToBool(bIsFolder)) { continue; } else { int ManualCount = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["ManualCount"].ToString()); int FileListID = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["FileListID"].ToString()); if (ArchiveID == 0) //在这里创建案卷 { ArchiveID = CreateAj(); } Model.T_FileList_MDL flMDL = fileListBLL.GetModel(FileListID); flMDL.ArchiveID = ConvertEx.ToInt(ArchiveID); flMDL.OldStatus = flMDL.Status; flMDL.Status = "100"; fileListBLL.Update(flMDL); PublicModel.writeLog(SystemSet.EumLogType.UpdData.ToString(), string.Concat("T_FileList;FileListID=", flMDL.FileListID, ";SingleProjectID=", flMDL.SingleProjectID, ";ArchiveID=", flMDL.ArchiveID, ";BH=", flMDL.BH, ";Title=", flMDL.Title, ";流程(接收整理)-组卷")); } } if (ArchiveID > 0) { Model.T_Archive_MDL acMDL = archiveBLL.GetModel(ArchiveID); acMDL.sl = ManualCountTotal; archiveBLL.Update(acMDL); archiveBLL.updateFileOrderIndexByArchiveID(ArchiveID.ToString()); } // Response.Redirect("ZJList.aspx?CompanyID=" + ctrlDropDownCompanyInfo1.SelectValue + "&SingleProjectID=" + SingleProjectID.Value + "&WorkFlowID=" + workflowid.Value); } }
/// <summary> /// Flag=2表示按所选节点组卷,1,自动组卷,3加入到指定案卷 /// </summary> /// <param name="flag"></param> /// <param name="selId"></param> private void DoZJ(string flag, string selId) { if (!string.IsNullOrWhiteSpace(ddlSingleProject.SelectValue)) { string strWhere = "SingleProjectID=" + ddlSingleProject.SelectValue + " and ISNULL(MyArchiveID,0)=0 "; if (flag == "2" || flag == "3") { strWhere += " and FileListID in (" + selId + ")"; } DataSet dsFileList = fileListBLL.GetList(strWhere); int ArchiveID = 0; int ManualCountTotal = 0; if (flag == "3") { if (TreeView2.Nodes[0].ChildNodes.Count > 0) { foreach (TreeNode tNode in TreeView2.Nodes[0].ChildNodes) { if (tNode.Checked)//选中案卷 { int tArchiveID = Common.ConvertEx.ToInt(tNode.Value.ToString()); Model.T_MyArchive_MDL acMDL = myArchiveBLL.GetModel(tArchiveID); if (acMDL != null) { ArchiveID = acMDL.ArchiveID; ManualCountTotal = acMDL.sl; } } } if (ArchiveID == 0) { Common.MessageBox.FnLayerAlert(this.Page, "请勾选右边的需加入的案卷!"); return; } } else { Common.MessageBox.FnLayerAlert(this.Page, "请勾选右边的需加入的案卷!"); return; } } if (dsFileList.Tables.Count > 0 && dsFileList.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsFileList.Tables[0].Rows.Count; i++) { string bIsFolder = dsFileList.Tables[0].Rows[i]["IsFolder"].ToString(); //为目录的数据不处理,跳到下一条 if (ConvertEx.ToBool(bIsFolder)) { continue; } else { int ManualCount = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["ManualCount"].ToString()); int FileListID = ConvertEx.ToInt(dsFileList.Tables[0].Rows[i]["FileListID"].ToString()); if (ArchiveID == 0) //在这里创建案卷 { ArchiveID = CreateAj(ddlSingleProject.SelectValue); } Model.T_FileList_MDL flMDL = fileListBLL.GetModel(FileListID); flMDL.MyArchiveID = ConvertEx.ToInt(ArchiveID); fileListBLL.Update(flMDL); } } if (ArchiveID > 0) { Model.T_MyArchive_MDL acMDL = myArchiveBLL.GetModel(ArchiveID); acMDL.sl = ManualCountTotal; myArchiveBLL.Update(acMDL); } } } }
public void ProcessRequest(HttpContext context) { string option = context.Request.Form["option"]; if (option == null) { option = context.Request.QueryString["option"]; } if ("calculateHash".Equals(option)) { string cert = context.Request.Form["cert"]; string imgData = context.Request.Form["imgData"]; string imgWidth = context.Request.Form["imgWidth"]; string imgHeight = context.Request.Form["imgHeight"]; string imgExt = context.Request.Form["imgExt"]; string fileIDS = context.Request.Form["fileIDS"]; string xPoint = context.Request.Form["xPoint"]; string yPoint = context.Request.Form["yPoint"]; string signatureDtflag = ConvertEx.ToString(context.Request.Form["signatureDtflag"]); bool signatureAllPagePdfflag = ConvertEx.ToBool(context.Request.Form["signatureAllPagePdfflag"]); //是否签所有页 string signaturePagen = context.Server.UrlDecode(context.Request.Form["signaturePagen"]); //特定页码集合 Hashtable pdfList = GetCleanPdfPath(fileIDS); if (pdfList.Count > 0) { KGPdfHummer hummer = null; string tagPdf = string.Empty; FileStream files = null; try { if (imgData == null) { throw new Exception("签章获取错误!"); } else { JArray objList = new JArray(); X509CertificateParser x509CertificateParser; X509Certificate x509Certificate; DigitalSignatureByKey digitalSignatureByKey; PdfSignature pdfSignature; PdfSignature4KG pdfSignature4KG = new PdfSignature4KG(null, 1, null); KGBase64 base64; KGTextInfo kgTextInfo; string base64str, data; int width, height; JObject obj; byte[] imgb; foreach (DictionaryEntry de in pdfList) { string sourcePdf = de.Value.ToString(); tagPdf = GetTagertPdf(sourcePdf); files = new FileStream(tagPdf, FileMode.Create); hummer = KGPdfHummer.CreateSignature(sourcePdf, null, true, files, null, true); x509CertificateParser = new X509CertificateParser(); // 公钥证书 x509Certificate = x509CertificateParser.ReadCertificate(Hex.Decode(cert)); digitalSignatureByKey = new DigitalSignatureByKey(); hummer.SetCertificate(x509Certificate, digitalSignatureByKey); pdfSignature = hummer.PdfSignature; base64 = new KGBase64(); base64str = imgData.Substring(0, 65); data = imgData.Substring(65); base64.SetBase64Table(base64str); imgb = base64.Decode(data); width = (int)(float.Parse(imgWidth) * 7200F / 254F); height = (int)(float.Parse(imgHeight) * 7200F / 254F); pdfSignature.SetImage(imgb, imgExt.Substring(1), width, height); ArrayList pagenList = new ArrayList(); string[] spPagen = (signaturePagen + ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var vr in spPagen) { pagenList.Add(ConvertEx.ToInt(vr)); } if (pagenList.Count < 1) { pagenList.Add(1); } if (!signatureAllPagePdfflag) //不签所有页,则签特定页 { pdfSignature.SetPagen((Int32[])pagenList.ToArray(typeof(Int32))); } //if (searTxt != "") //{ // pdfSignature.SetText(searTxt, true); //} //else //{ // pdfSignature.SetXY(200F, 200F); //} pdfSignature.SetXY(float.Parse(xPoint), float.Parse(yPoint)); hummer.PdfSignature = pdfSignature; if (signatureDtflag == "1") //签章加日期 { pdfSignature4KG.SetImage(imgb, imgExt.Substring(1), width, height); if (!signatureAllPagePdfflag)//不签所有页,则签特定页 { pdfSignature4KG.SetPagen((Int32[])pagenList.ToArray(typeof(Int32))); } pdfSignature4KG.SetXY(float.Parse(xPoint), float.Parse(yPoint)); kgTextInfo = new KGTextInfo(DateTime.Now.ToString("yyyy年MM月dd日")); kgTextInfo.Font = new System.Drawing.Font("宋体", 12); kgTextInfo.PosType = TextInfoPosType.OUT_SOUTH_MIDDLE; pdfSignature4KG.AddImgText(kgTextInfo); hummer.PdfSignature = pdfSignature4KG; } hummer.DoSignature(); obj = new JObject() { new JProperty("fileID", de.Key.ToString()), new JProperty("file", tagPdf), new JProperty("hash", digitalSignatureByKey.GetHash()), new JProperty("contentsPostion", digitalSignatureByKey.GetContentsPostion()), }; objList.Add(obj); } context.Response.Write(objList.ToString()); } } catch (Exception ex) { if (ex.Message.Contains("iSignature_PDF_API中间件已过期")) { context.Response.Write("系统签章过期"); } else { context.Response.Write("系统签章异常:" + ex.Message.ToString()); } } finally { try { if (files != null) { files.Close(); } } catch { } if (hummer != null) { hummer.Close(); } } } } else if ("rewriteSigned".Equals(option)) { string cert = context.Request.Form["cert"]; JArray objList = (JArray)JsonConvert.DeserializeObject(context.Request.Form["jArray"]); if (objList != null && objList.Count > 0) { // 公钥证书 X509CertificateParser x509CertificateParser = new X509CertificateParser(); X509Certificate x509Certificate = x509CertificateParser.ReadCertificate(Hex.Decode(cert)); DigitalSignatureByKey digitalSignatureByKey; foreach (JObject obj in objList) { string fileID = Common.ConvertEx.ToString(obj["fileID"]); string pdfPath = Common.ConvertEx.ToString(obj["file"]); long pos = Common.ConvertEx.ToLong(obj["contentsPostion"]); string contents = Common.ConvertEx.ToString(obj["contents"]); digitalSignatureByKey = new DigitalSignatureByKey(); digitalSignatureByKey.RewriteContents(pdfPath, x509Certificate.GetEncoded(), pos, contents); UpdateSignatureStatus(fileID, pdfPath, context); } } context.Response.Write("完成域数字签名!"); } }