119 lines
4.2 KiB
C#
119 lines
4.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Web;
|
|
using SuperMap.RealEstate.ServiceModel;
|
|
using SuperMap.RealEstate.Utility;
|
|
using SuperMap.RealEstate.Web.UI;
|
|
using HWSB = SuperMap.RealEstate.HighWay.Storage.Business;
|
|
|
|
namespace SuperMap.RealEstate.HighWay.Modules.ProblemDeal
|
|
{
|
|
public partial class IMAGEPage : BasePage
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
|
|
if (Request["ReadOnly"] != null && Request["ReadOnly"].ToString() == ModifyTypeEnum.ReadOnlyVisible.ToString())
|
|
{
|
|
ButtonSave.Visible = false;
|
|
ButtonDelete.Visible = false;
|
|
}
|
|
//载入数据
|
|
//ButtonDelete.Enabled = IMAGE1.LoadData();
|
|
//设置删除提示
|
|
SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?");
|
|
//设置按钮状态
|
|
SetControlClientAction(ButtonDelete, false, true, true);
|
|
SetControlClientAction(ButtonSave);
|
|
//注册遮罩式窗口关闭脚本
|
|
SetControlClosePopDialog(ButtonClose);
|
|
}
|
|
|
|
protected void ButtonSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (mFileUpload.FileName.ToString() == "")
|
|
{
|
|
Alert("请选择凭证图片");
|
|
return;
|
|
}
|
|
string ImagePathSrc = string.Empty;
|
|
Storage.Business.IMAGE _IMAGE = new Storage.Business.IMAGE(this.Transaction);
|
|
if (mFileUpload.HasFile)
|
|
{
|
|
string extension = Path.GetExtension(mFileUpload.PostedFile.FileName).ToLower();
|
|
string newname = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_ffff") + extension;
|
|
if (extension == ".jpg" || extension == ".gif" || extension == ".png")
|
|
{
|
|
ImagePathSrc += "/UploadImageDir/ENDACCOUNT/";
|
|
string savePath = Server.MapPath("~/UploadImageDir/ENDACCOUNT/");
|
|
if (!Directory.Exists(savePath))
|
|
{
|
|
Directory.CreateDirectory(savePath);
|
|
}
|
|
mFileUpload.PostedFile.SaveAs(savePath + newname);
|
|
ImagePathSrc += newname;
|
|
if (!string.IsNullOrEmpty(Request["ENDACCOUNT_ID"]))
|
|
{
|
|
_IMAGE.Table_ID = int.Parse(Request["ENDACCOUNT_ID"].ToDecrypt());
|
|
_IMAGE.Table_Name = "HIGHWAY_SELLDATA.T_ENDACCOUNT";
|
|
}
|
|
|
|
_IMAGE.IMAGE_PATH = ImagePathSrc;
|
|
_IMAGE.IMAGE_DATE = System.DateTime.Now;
|
|
_IMAGE.IMAGE_TITLE = IMAGE_TITLE.Text;
|
|
_IMAGE.Insert();
|
|
|
|
Alert("保存凭证成功!", 3);
|
|
IMAGE1.BindTreeView();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert("图片格式有误!", 3);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("保存失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("保存失败!");
|
|
#endif
|
|
}
|
|
}
|
|
|
|
protected void ButtonDelete_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//删除数据
|
|
IMAGE1.Delete();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(RefreshGridPageType.Delete);
|
|
//提示信息
|
|
Alert("删除成功!", 3);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("删除失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("删除失败!");
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
}
|