74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using SuperMap.RealEstate.Utility;
|
|
using Newtonsoft.Json.Linq;
|
|
using HZQR.Common;
|
|
|
|
namespace SuperMap.RealEstate.SendRec.Handler
|
|
{
|
|
/// <summary>
|
|
/// Filehelper 的摘要说明
|
|
/// </summary>
|
|
public class Filehelper : IHttpHandler
|
|
{
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
string action_type = Pub.Request("action_type");
|
|
|
|
//文件操作
|
|
string RetString = string.Empty;
|
|
ServiceModel.Transaction _Transaction = new ServiceModel.Transaction();
|
|
try
|
|
{
|
|
switch (action_type)
|
|
{
|
|
case "": //上传附件
|
|
RetString = BusinessHelper.UploadFile(context, _Transaction);
|
|
break;
|
|
case "DeleteFile": //删除附件文件和数据记录
|
|
RetString= BusinessHelper.DeleteFile(_Transaction, true);
|
|
break;
|
|
|
|
case "deletefilebycode": //删除附件数据记录
|
|
BusinessHelper.DeleteFile(_Transaction);
|
|
break;
|
|
}
|
|
|
|
_Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_Transaction.Rollback();
|
|
ex = ex ?? ex.InnerException;
|
|
ErrorLogHelper.Write(ex, action_type, action_type);
|
|
|
|
JObject info = new JObject();
|
|
info["Result_Code"] = 999;
|
|
info["Result_Desc"] = "传输失败" + ex.Message;
|
|
RetString = info.ToString();
|
|
}
|
|
finally
|
|
{
|
|
if (_Transaction.IsOpen)
|
|
{
|
|
_Transaction.Dispose();
|
|
_Transaction.Release();
|
|
}
|
|
}
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(RetString);
|
|
context.Response.End();
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |