172 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			172 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Linq;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
using BLL;
 | 
						|
 | 
						|
namespace FineUIPro.Web.CQMS.Information
 | 
						|
{
 | 
						|
    public partial class ConfirmFormView : PageBase
 | 
						|
    {
 | 
						|
        #region 定义变量
 | 
						|
        /// <summary>
 | 
						|
        /// 方案审查主键
 | 
						|
        /// </summary>
 | 
						|
        public string ConfirmFormId
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["ConfirmFormId"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["ConfirmFormId"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 定义集合
 | 
						|
        /// <summary>
 | 
						|
        /// 定义会签意见集合
 | 
						|
        /// </summary>
 | 
						|
        public static List<Model.CQMS_ConfirmFormApprove> approves = new List<Model.CQMS_ConfirmFormApprove>();
 | 
						|
        #endregion
 | 
						|
 | 
						|
        public int ContactImg
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return Convert.ToInt32(ViewState["ContactImg"]);
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["ContactImg"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                BLL.SecretLevelService.InitSecretLevelDropDownList(drpSecretLevel, true);
 | 
						|
                UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
 | 
						|
                WorkOrderService.InitWorkOrderList(drpWorkOrderIds, CurrUser.LoginProjectId, true);
 | 
						|
                ContactImg = 0;
 | 
						|
                //CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.UserId, Const.ConfirmFormMenuId);
 | 
						|
                txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | 
						|
                ConfirmFormId = Request.Params["confirmFormId"];
 | 
						|
                if (!string.IsNullOrWhiteSpace(ConfirmFormId))
 | 
						|
                {
 | 
						|
                    HFConfirmFormId.Text = ConfirmFormId;
 | 
						|
                    Model.CQMS_ConfirmForm confirmForm = ConfirmFormService.GetConfirmFormByConfirmFormId(ConfirmFormId);
 | 
						|
                    txtConfirmFormCode.Text = confirmForm.ConfirmFormCode;
 | 
						|
                    if (!string.IsNullOrEmpty(confirmForm.SecretLevelId))
 | 
						|
                    {
 | 
						|
                        drpSecretLevel.SelectedValue = confirmForm.SecretLevelId;
 | 
						|
                    }
 | 
						|
                    if (!string.IsNullOrEmpty(confirmForm.UnitId))
 | 
						|
                    {
 | 
						|
                        drpUnit.SelectedValue = confirmForm.UnitId;
 | 
						|
                    }
 | 
						|
                    this.txtContractNo.Text = confirmForm.ContractNo;
 | 
						|
                    if (!string.IsNullOrEmpty(confirmForm.WorkOrderIds))
 | 
						|
                    {
 | 
						|
                        this.drpWorkOrderIds.SelectedValueArray = confirmForm.WorkOrderIds.Split(',');
 | 
						|
                    }
 | 
						|
                    this.txtTaskTheme.Text = confirmForm.TaskTheme;
 | 
						|
                    if (confirmForm.CompileDate != null)
 | 
						|
                    {
 | 
						|
                        txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", confirmForm.CompileDate);
 | 
						|
                    }
 | 
						|
                    if (confirmForm.Edition != null)
 | 
						|
                    {
 | 
						|
                        txtEdition.Text = confirmForm.Edition.ToString();
 | 
						|
                    }
 | 
						|
                    this.Grid1.DataSource = BLL.ConfirmFormDetailService.GetLists(ConfirmFormId);
 | 
						|
                    this.Grid1.DataBind();
 | 
						|
                    bindApprove();
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        private void NoEdit()
 | 
						|
        {
 | 
						|
            txtConfirmFormCode.Enabled = false;
 | 
						|
            drpSecretLevel.Enabled = false;
 | 
						|
            drpUnit.Enabled = false;
 | 
						|
            drpWorkOrderIds.Enabled = false;
 | 
						|
            txtContractNo.Enabled = false;
 | 
						|
            txtTaskTheme.Enabled = false;
 | 
						|
            txtCompileDate.Enabled = false;
 | 
						|
            txtEdition.Enabled = false;
 | 
						|
            ContactImg = -1;
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 审批列表
 | 
						|
        /// </summary>
 | 
						|
        private void bindApprove()
 | 
						|
        {
 | 
						|
            var list = ConfirmFormApproveService.getListData(ConfirmFormId);
 | 
						|
            gvApprove.DataSource = list;
 | 
						|
            gvApprove.DataBind();
 | 
						|
        }
 | 
						|
        public string man(Object man)
 | 
						|
        {
 | 
						|
            string appman = string.Empty;
 | 
						|
            if (UserService.GetUserByUserId(man.ToString()) != null)
 | 
						|
            {
 | 
						|
                appman = UserService.GetUserByUserId(man.ToString()).UserName;
 | 
						|
            }
 | 
						|
            return appman;
 | 
						|
        }
 | 
						|
 | 
						|
        protected void imgBtnFile_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(HFConfirmFormId.Text))   //新增记录
 | 
						|
            {
 | 
						|
                HFConfirmFormId.Text = SQLHelper.GetNewID(typeof(Model.CQMS_ConfirmForm));
 | 
						|
            }
 | 
						|
 | 
						|
            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | 
						|
            String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ConfirmForm&menuId={2}",
 | 
						|
            -1, HFConfirmFormId.Text, Const.ConfirmFormMenuId)));
 | 
						|
        }
 | 
						|
 | 
						|
        protected void btnapprove_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            //HFConfirmFormId.Text
 | 
						|
            var approve = ConfirmFormApproveService.GetConfirmFormApproveByApproveMan(HFConfirmFormId.Text, CurrUser.UserId);
 | 
						|
            if (approve != null)
 | 
						|
            {
 | 
						|
                var approveId = approve.ConfirmFormApproveId;
 | 
						|
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | 
						|
                String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ConfirmForm&menuId={2}",
 | 
						|
                -1, approveId, Const.ConfirmFormMenuId)));
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
        protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e)
 | 
						|
        {
 | 
						|
            object[] keys = gvApprove.DataKeys[e.RowIndex];
 | 
						|
            string fileId = string.Empty;
 | 
						|
            if (keys == null)
 | 
						|
            {
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                fileId = keys[0].ToString();
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
 | 
						|
                 String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ConfirmForm&menuId={2}",
 | 
						|
                 -1, fileId, Const.ConfirmFormMenuId)));
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |