108 lines
4.6 KiB
C#
108 lines
4.6 KiB
C#
using System;
|
||
using System.Data;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using SuperMap.RealEstate.ServiceModel;
|
||
using FRB = SuperMap.RealEstate.Contract.Running.Business;
|
||
using FSB = SuperMap.RealEstate.Contract.Storage.Business;
|
||
using Newtonsoft.Json.Linq;
|
||
using HZQR.Common;
|
||
|
||
namespace SuperMap.RealEstate.Contract.Handler.CommonInterface
|
||
{
|
||
public class BusinessHelper
|
||
{
|
||
#region 方法 -> 获取图片信息(待修改)
|
||
public static string GetImageList(Transaction _Transaction)
|
||
{
|
||
int RowCount = 0;
|
||
string RetString = "";
|
||
string _CONTRACTPROINST_ID = Common.Common.Request("action_data");
|
||
try
|
||
{
|
||
DataTable IMAGETable = new FSB.ATTACHMENT(_Transaction).FillDataTable("WHERE TABLE_ID = " +
|
||
_CONTRACTPROINST_ID + " AND TABLE_NAME = 'T_CONTRACTPROINST' ORDER BY IMAGE_ID");
|
||
|
||
FRB.CONTRACTPROINST _CONTRACTPROINST = new FRB.CONTRACTPROINST(_Transaction);
|
||
_CONTRACTPROINST.CONTRACTPROINST_ID_Encrypt = _CONTRACTPROINST_ID.ToEncrypt();
|
||
if (IMAGETable != null && IMAGETable.Rows.Count > 0 && _CONTRACTPROINST.Select())
|
||
{
|
||
foreach (DataRow _DataRow in IMAGETable.Rows)
|
||
{
|
||
RetString += "<li><div class=\"show-img-file\"><input type=\"image\"" +
|
||
" name=\"ctl00$M$user1$ratTable$ctl00$ImgShow\" id=\"M_user1_ratTable_ImgShow_" + RowCount +
|
||
"\" title=\"" + _DataRow["IMAGE_TITLE"].ToString() + "\" validationgroup=\"UCGN1\" submitvalidation=\"true\"" +
|
||
" src=\"" + _DataRow["IMAGE_URL"].ToString() + "\" alt=\"加载中……\"" +
|
||
" onclick=\"javascript:return RealEstate.Page.DoClientAction(event,\"Dialog.OpenPopDialog(\"IMAGEPage\",\"" +
|
||
HttpContext.Current.Request.UserHostAddress + "/Finance/Compents/FinanceBill/ZheJiang/IMAGEPage.aspx?ID=" +
|
||
_DataRow["IMAGE_ID"].ToEncrypt() + "&CONTRACTPROINST_ID=" + _CONTRACTPROINST.CONTRACTPROINST_ID_Encrypt +
|
||
"&IMAGE_URL=" + HttpUtility.UrlEncode(_DataRow["IMAGE_URL"].ToString()) + "&ActInst_ID=" +
|
||
_CONTRACTPROINST.__ProInst.NowActInst.ActInst_ID.ToEncrypt() +
|
||
"&ReadOnly=ReadOnlyVisible&PopDialogName=IMAGEPage\",850,600,true,\"false\",true,true);\");\"" +
|
||
" style=\"width:100%;\"></div></li>";
|
||
RowCount++;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SuperMap.RealEstate.Utility.ErrorLogHelper.Write(ex);
|
||
}
|
||
|
||
return RetString;
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 删除附件
|
||
public static string DeleteFile(ServiceModel.Transaction _Transaction)
|
||
{
|
||
string reString = "";
|
||
JObject info = new JObject();
|
||
|
||
try
|
||
{
|
||
string ImageID = Pub.Request("ImageID");
|
||
string FilePath = "~/UploadImageDir/CONTRACTPROINST/";
|
||
Running.Business.ATTACHMENT _ATTACHMENT = new Running.Business.ATTACHMENT(_Transaction);
|
||
_ATTACHMENT.ATTACHMENT_ID_Encrypt = ImageID;
|
||
if (_ATTACHMENT.Select())
|
||
{
|
||
if (Directory.Exists(HttpContext.Current.Server.MapPath(FilePath)) &&
|
||
File.Exists(HttpContext.Current.Server.MapPath(_ATTACHMENT.ATTACHMENT_PATH)))
|
||
{
|
||
File.Delete(HttpContext.Current.Server.MapPath(_ATTACHMENT.ATTACHMENT_PATH));
|
||
}
|
||
_ATTACHMENT.Delete();
|
||
}
|
||
|
||
_Transaction.Commit();
|
||
|
||
info["Result_Code"] = 100;
|
||
info["Result_Desc"] = "删除成功!";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
_Transaction.Rollback();
|
||
ex = ex ?? ex.InnerException;
|
||
info["Result_Code"] = 999;
|
||
info["Result_Desc"] = "删除失败" + ex.Message;
|
||
SuperMap.RealEstate.Utility.ErrorLogHelper.Write(ex, "DeleteFile", "DeleteFile");
|
||
}
|
||
finally
|
||
{
|
||
if (_Transaction.IsOpen)
|
||
{
|
||
_Transaction.Dispose();
|
||
_Transaction.Release();
|
||
}
|
||
}
|
||
|
||
reString = info.ToString();
|
||
|
||
return reString;
|
||
}
|
||
#endregion
|
||
}
|
||
} |