/// <summary> /// 证书附件上传 /// </summary> /// <param name="tSingleProjectID"></param> protected void UploadFile(int tSingleProjectID) { HttpFileCollection uploadFiles = HttpContext.Current.Request.Files;//获取所有客户端上传文件对象 HttpPostedFile userPostFile = null; if (uploadFiles.Count > 0) { for (int i = 0; i < uploadFiles.Count; i++) { userPostFile = uploadFiles[i];//获取独立的文件对象 string fileName = Common.Common.SaveFile(Server.MapPath(savePath), userPostFile, "R"); if (fileName != "") { T_FileAttach_BLL bll = new T_FileAttach_BLL(); T_FileAttach_MDL mdl = new T_FileAttach_MDL(); mdl.AttachName = fileName; mdl.AttachPath = savePath + fileName; mdl.CreateDate = DateTime.Now; mdl.PriKeyValue = tSingleProjectID; mdl.OrderIndex = 0; mdl.Flag = "Company_Registration"; if (Hid_ghxkz.Value != "" && ghxkzh.Text.Trim() != "") { Hid_ghxkz.Value = ""; mdl.AttachCode = SystemSet.EumProject_Credentials.ghxkz.ToString(); bll.Add(mdl); } else if (Hid_sgxkz.Value != "" && sgxkzh.Text.Trim() != "") { Hid_sgxkz.Value = ""; mdl.AttachCode = SystemSet.EumProject_Credentials.sgxkz.ToString(); bll.Add(mdl); } else if (Hid_other.Value != "") { mdl.AttachCode = SystemSet.EumProject_Credentials.other.ToString(); bll.Add(mdl); } } } } }
protected void lbtnAdd_Click(object sender, EventArgs e) { List <string> sellist = ctrlGridEx1.GetSelects(); if (sellist.Count > 0) { List <int> rowIndexList = ctrlGridEx1.GetSelectsRowIndexList(); for (int i = 0; i < sellist.Count; i++) { FileUpload f1 = (FileUpload)ctrlGridEx1.Rows[rowIndexList[i]].Cells[5].Controls[0]; string savePath = "/Upload/CompanySignet/"; string fileName = Common.Common.SaveFile(Server.MapPath(savePath), f1.PostedFile, "Signet_", "jpg,gif,bmp"); if (fileName != "") { string SystemInfoID = sellist[i]; Model.T_SystemInfo_MDL sysMDL = (new BLL.T_SystemInfo_BLL()).GetModel(Common.ConvertEx.ToInt(SystemInfoID)); T_FileAttach_BLL fileAttBLL = new T_FileAttach_BLL(); T_FileAttach_MDL fileAttMDL = new T_FileAttach_MDL(); fileAttMDL.Flag = sysMDL.CurrentType; fileAttMDL.PriKeyValue = Common.ConvertEx.ToInt(_CompanyID); fileAttMDL.AttachPath = savePath + fileName; fileAttMDL.AttachName = sysMDL.CurrentTypeCNName; fileAttMDL.AttachCode = sysMDL.SystemInfoCode; fileAttMDL.CreateDate = DateTime.Now; fileAttMDL.OrderIndex = 1; fileAttMDL.AttachID = Common.ConvertEx.ToInt(ctrlGridEx1.Rows[rowIndexList[i]].Cells[1].Text); if (fileAttMDL.AttachID == 0) { fileAttBLL.Add(fileAttMDL); } else { fileAttBLL.Update(fileAttMDL); } } } BindGrid(); } }
/// <summary> /// 将Model值赋给控件 /// </summary> /// <param name="tSingleProjectID">工程ID</param> public void DataBindEx(int tSingleProjectID) { CTRL_AREA.BindDdlArea(true); ProjectType.DataBindEx(); if (tSingleProjectID > 0) { T_SingleProject_MDL spMdl = new T_SingleProject_BLL().GetModel(tSingleProjectID); //获取工程Model Comm.SetValueToPage(spMdl, tablemain); //将Model值赋给控件 int ConstructionProjectID = Common.ConvertEx.ToInt(spMdl.ConstructionProjectID); //获取项目ID gcdd.Text = spMdl.gcqy + spMdl.gcdd; if (ConstructionProjectID > 0) { T_Construction_Project_MDL cpMdl = new T_Construction_Project_BLL().GetModel(ConstructionProjectID); if (cpMdl != null) { int CompanyID = Common.ConvertEx.ToInt(cpMdl.CompanyID); //通过项目获取单位ID if (CompanyID > 0) { T_Company_MDL cMdl = new T_Company_BLL().GetModel(CompanyID); Comm.SetValueToPage(cMdl, table_Company); } } StringBuilder ghxkz = new StringBuilder(); StringBuilder sgxkz = new StringBuilder(); StringBuilder other = new StringBuilder(); //获取工程对应的所有上传证件的附件 List <T_FileAttach_MDL> lt_ftMdl = new T_FileAttach_BLL().GetModelList("PriKeyValue=" + tSingleProjectID.ToString()); foreach (T_FileAttach_MDL ftMdl in lt_ftMdl) { if (ftMdl.AttachCode == "ghxkz") { ghxkz.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } else if (ftMdl.AttachCode == "sgxkz") { sgxkz.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } else if (ftMdl.AttachCode == "other") { other.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } } if (ghxkz.Length > 0) { ltghxkz.Text = ghxkz.ToString(); } if (sgxkz.Length > 0) { ltsgxkz.Text = sgxkz.ToString(); } if (other.Length > 0) { ltother.Text = other.ToString(); } } } }
private void DataBindEx() { T_SingleProject_MDL projectmdl = singleProjectBLL.GetModel(ConvertEx.ToInt(HSingleProjectID.Value)); c_single_project_MDL a_projectmdl = csingleProjectBLL.GetModel(ConvertEx.ToInt(HSingleProjectID.Value)); if (projectmdl != null && a_projectmdl != null) { projectmdl.fz = a_projectmdl.fz; StringBuilder singlePoint = new StringBuilder(); StringBuilder ghxkz = new StringBuilder(); StringBuilder sgxkz = new StringBuilder(); StringBuilder other = new StringBuilder(); StringBuilder allStr = new StringBuilder(); #region 获取显示工程所有的坐标信息,按OrderIndex排序 List <T_SingleProject_Point_MDL> ltPoint = new T_SingleProject_Point_BLL().GetModelList("SingleProjectID=" + projectmdl.SingleProjectID); if (ltPoint != null && ltPoint.Count > 0) { singlePoint.Append("<table class=\"zpxxxj\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> "); singlePoint.Append("<tr>"); singlePoint.Append(" <td colspan=\"4\" style=\"height: 10px\"><strong>工程坐标信息预览</strong></td>"); singlePoint.Append("</tr>"); int index = 0; foreach (T_SingleProject_Point_MDL pintMDL in ltPoint) { index++; singlePoint.Append(" <tr>"); singlePoint.Append(" <td class=\"ww\">X" + index + "坐标:</td>"); singlePoint.Append(" <td>"); singlePoint.Append(" <input type=\"text\" readonly=\"readonly\" value=\"" + pintMDL.X + "\" title=\"" + pintMDL.X + "\" class=\"dd\" />"); singlePoint.Append(" </td>"); singlePoint.Append(" <td class=\"ww\">Y" + index + "坐标:</td>"); singlePoint.Append(" <td>"); singlePoint.Append(" <input type=\"text\" readonly=\"readonly\" value=\"" + pintMDL.Y + "\" title=\"" + pintMDL.Y + "\" class=\"dd\" />"); singlePoint.Append(" </td>"); singlePoint.Append(" </tr> "); } singlePoint.Append("</table>"); ltPointHtml.Text = singlePoint.ToString(); } #endregion #region 获取工程对应的所有上传证件的附件 List <T_FileAttach_MDL> lt_ftMdl = new T_FileAttach_BLL().GetModelList("PriKeyValue=" + projectmdl.SingleProjectID); foreach (T_FileAttach_MDL ftMdl in lt_ftMdl) { if (ftMdl.AttachCode == "ghxkz") { ghxkz.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } else if (ftMdl.AttachCode == "sgxkz") { sgxkz.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } else if (ftMdl.AttachCode == "other") { other.Append(" <a style=\"color:black;\" href=\"" + ftMdl.AttachPath + "\" title='点击查看' target=\"_blank\">" + ftMdl.AttachName + "</a> "); } } if (ghxkz.Length > 0 || sgxkz.Length > 0 || other.Length > 0) { allStr.Append("<table class=\"zpxxxj\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); allStr.Append("<tr>"); allStr.Append("<td colspan=\"4\" style=\"height: 10px\">"); allStr.Append("<strong>文号项扫描件预览</strong>"); allStr.Append("</td>"); allStr.Append("</tr>"); } if (ghxkz.Length > 0 || sgxkz.Length > 0) { allStr.Append("<tr>"); if (ghxkz.Length > 0) { allStr.Append("<td class=\"ww\">规划许可证号:</td>"); allStr.Append("<td>"); allStr.Append(ghxkz.ToString()); allStr.Append("</td>"); } if (sgxkz.Length > 0) { allStr.Append("<td class=\"ww\">施工许可证号:</td>"); allStr.Append("<td>"); allStr.Append(sgxkz.ToString()); allStr.Append("</td>"); } allStr.Append("</tr>"); } if (other.Length > 0) { allStr.Append("<tr>"); allStr.Append(" <td class=\"ww\">其它证件附件:"); allStr.Append("</td>"); allStr.Append(" <td colspan=\"3\" style=\"word-break: break-all;\">"); allStr.Append(other.ToString()); allStr.Append(" </td>"); allStr.Append("</tr>"); } allStr.Append("</table>"); ltImage.Text = allStr.ToString(); #endregion } Comm.SetValueToPage(projectmdl, tablemain); if (jsdw.Text == "") { jsdw.Text = Common.Session.GetSession("CompanyName"); } }