ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGLServer/BaseInfo/JointImageEdit.aspx.cs

98 lines
3.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.HJGLServer.BaseInfo
{
public partial class JointImageEdit : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
string jointImageId = Request.Params["JointImageId"];
if (!string.IsNullOrEmpty(jointImageId))
{
Model.HJGL_WeldingProcedure_JointImage jointImage = BLL.HJGL_JointImageService.GetJointImageById(jointImageId);
if (jointImage!=null)
{
this.txtJointImageName.Text = jointImage.JointImageName;
this.txtRemark.Text = jointImage.Remark;
}
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 提交数据
/// </summary>
private void SaveData()
{
string jointImageId = Request.Params["JointImageId"];
Model.HJGL_WeldingProcedure_JointImage jointImage = new Model.HJGL_WeldingProcedure_JointImage();
jointImage.JointImageName = this.txtJointImageName.Text.Trim();
jointImage.Remark = this.txtRemark.Text.Trim();
if (!string.IsNullOrEmpty(jointImageId))
{
jointImage.JointImageId = jointImageId;
BLL.HJGL_JointImageService.UpdateJointImage(jointImage);
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊接接头简图");
}
else
{
jointImageId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingProcedure_JointImage));
jointImage.JointImageId = jointImageId;
BLL.HJGL_JointImageService.AddJointImage(jointImage);
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊接接头简图");
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_JointImageMenuId, BLL.Const.BtnSave))
{
if (string.IsNullOrEmpty(Request.Params["JointImageId"]))
{
SaveData();
}
edit = "1";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGLServer/BaseInfo&menuId={1}&edit={2}", Request.Params["JointImageId"], Const.HJGL_JointImageMenuId, edit)));
}
}
#endregion
}
}