120 lines
5.3 KiB
C#
120 lines
5.3 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.Finance.Running.Business;
|
|
using FSB = SuperMap.RealEstate.Finance.Storage.Business;
|
|
using Newtonsoft.Json.Linq;
|
|
using HZQR.Common;
|
|
|
|
namespace SuperMap.RealEstate.Finance.Handler.CommonInterface
|
|
{
|
|
public class BusinessHelper
|
|
{
|
|
#region 方法 -> 获取图片信息
|
|
public static string GetImageList(Transaction _Transaction)
|
|
{
|
|
int RowCount = 0;
|
|
string RetString = "";
|
|
string _FINANCEPROINST_ID = Common.Common.Request("action_data");
|
|
try
|
|
{
|
|
DataTable IMAGETable = new FSB.IMAGE(_Transaction).FillDataTable("WHERE TABLE_ID = " +
|
|
_FINANCEPROINST_ID + " AND TABLE_NAME = 'T_FINANCEPROINST' ORDER BY IMAGE_ID");
|
|
|
|
FRB.FINANCEPROINST _FINANCEPROINST = new FRB.FINANCEPROINST(_Transaction);
|
|
_FINANCEPROINST.FINANCEPROINST_ID_Encrypt = _FINANCEPROINST_ID.ToEncrypt();
|
|
if (IMAGETable != null && IMAGETable.Rows.Count > 0 && _FINANCEPROINST.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() + "&FINANCEPROINST_ID=" + _FINANCEPROINST.FINANCEPROINST_ID_Encrypt +
|
|
"&IMAGE_URL=" + HttpUtility.UrlEncode(_DataRow["IMAGE_URL"].ToString()) + "&ActInst_ID=" +
|
|
_FINANCEPROINST.__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/FINANCEPROINST/";
|
|
Running.Business.ATTACHMENT _ATTACHMENT = new Running.Business.ATTACHMENT(_Transaction);
|
|
_ATTACHMENT.ATTACHMENT_ID_Encrypt = ImageID;
|
|
if (_ATTACHMENT.Select())
|
|
{
|
|
if (!string.IsNullOrEmpty(_ATTACHMENT.OTHER_NAME) && !string.IsNullOrEmpty(_ATTACHMENT.ATTACHMENT_NAME))
|
|
{
|
|
if (Directory.Exists(HttpContext.Current.Server.MapPath(FilePath) +
|
|
_ATTACHMENT.OTHER_NAME + _ATTACHMENT.ATTACHMENT_NAME))
|
|
{
|
|
Directory.Delete(HttpContext.Current.Server.MapPath(FilePath) +
|
|
_ATTACHMENT.OTHER_NAME + _ATTACHMENT.ATTACHMENT_NAME, true);
|
|
}
|
|
}
|
|
else if (!string.IsNullOrEmpty(_ATTACHMENT.ATTACHMENT_NAME))
|
|
{
|
|
if (Directory.Exists(HttpContext.Current.Server.MapPath(FilePath)) &&
|
|
File.Exists(HttpContext.Current.Server.MapPath(FilePath) + _ATTACHMENT.ATTACHMENT_NAME))
|
|
{
|
|
File.Delete(HttpContext.Current.Server.MapPath(FilePath) + _ATTACHMENT.ATTACHMENT_NAME);
|
|
}
|
|
}
|
|
_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
|
|
}
|
|
} |