118 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			4.4 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.HJGL.WeldingManage
 | 
						|
{
 | 
						|
    public partial class WeldRepairCardFinalFile : PageBase
 | 
						|
    {
 | 
						|
        #region 定义项
 | 
						|
        /// <summary>
 | 
						|
        /// 主键
 | 
						|
        /// </summary>
 | 
						|
        private string WeldRepairCardId
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["WeldRepairCardId"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["WeldRepairCardId"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #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();
 | 
						|
                this.txtCompileMan.Text = this.CurrUser.UserName;
 | 
						|
                this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | 
						|
                this.drpJotId.DataValueField = "JOT_ID";
 | 
						|
                this.drpJotId.DataTextField = "JOT_JointNo";
 | 
						|
                this.drpJotId.DataSource = (from x in Funs.DB.HJGL_View_JointInfo where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
 | 
						|
                this.drpJotId.DataBind();
 | 
						|
                Funs.FineUIPleaseSelect(this.drpJotId);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 提交
 | 
						|
        /// <summary>
 | 
						|
        /// 提交按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnSave_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            SaveData(true);
 | 
						|
            ShowNotify("提交成功!", MessageBoxIcon.Success);
 | 
						|
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 提交数据
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="isClose"></param>
 | 
						|
        private void SaveData(bool isClose)
 | 
						|
        {
 | 
						|
            Model.HJGL_WeldingProcedure_WeldRepairCard newWeldRepairCard = new Model.HJGL_WeldingProcedure_WeldRepairCard();
 | 
						|
            newWeldRepairCard.ProjectId = this.CurrUser.LoginProjectId;
 | 
						|
            newWeldRepairCard.WeldRepairCardCode = this.txtWeldRepairCardCode.Text.Trim();
 | 
						|
            newWeldRepairCard.CompileMan = this.txtCompileMan.Text.Trim();
 | 
						|
            newWeldRepairCard.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
 | 
						|
            if (this.drpJotId.SelectedValue!=BLL.Const._Null)
 | 
						|
            {
 | 
						|
                newWeldRepairCard.JOT_ID = this.drpJotId.SelectedValue;
 | 
						|
            }
 | 
						|
            newWeldRepairCard.Flag = "1";
 | 
						|
            if (!string.IsNullOrEmpty(this.WeldRepairCardId))
 | 
						|
            {
 | 
						|
                newWeldRepairCard.WeldRepairCardId = this.WeldRepairCardId;
 | 
						|
                BLL.HJGL_WeldRepairCardService.UpdateWeldRepairCard(newWeldRepairCard);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                this.WeldRepairCardId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingProcedure_WeldRepairCard));
 | 
						|
                newWeldRepairCard.WeldRepairCardId = this.WeldRepairCardId;
 | 
						|
                BLL.HJGL_WeldRepairCardService.AddWeldRepairCard(newWeldRepairCard);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 附件上传
 | 
						|
        /// <summary>
 | 
						|
        /// 上传附件资源
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnAttachUrl_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
 | 
						|
            string tokey = "";
 | 
						|
            if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_WeldRepairCardMenuId, BLL.Const.BtnSave))
 | 
						|
            {
 | 
						|
                if (string.IsNullOrEmpty(this.WeldRepairCardId))
 | 
						|
                {
 | 
						|
                    SaveData(false);
 | 
						|
                }
 | 
						|
                tokey = this.WeldRepairCardId;
 | 
						|
                edit = "1";
 | 
						|
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGL/WeldRepairCard&menuId={1}&edit={2}", tokey, Const.HJGL_WeldRepairCardMenuId, edit)));
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |