/// <summary>
        /// Valid before register new project data
        /// </summary>
        /// <returns></returns>
        public ActionResult CTS230_ConfirmRegisterProject()
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>();       //Check Suspend
                ICommonHandler         ComH  = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (ComH.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                if (!CheckUserPermission(ScreenID.C_SCREEN_ID_PROJ_NEW, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063);
                    return(Json(res));
                }


                string ProjectCode = RegisterData(param.InitialData.doRegisterData);
                res.ResultData = ProjectCode;
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
        }
        /// <summary>
        /// Clear session screen CTS230
        /// </summary>
        /// <returns></returns>
        public ActionResult ClearScreenParam()
        {
            CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>();

            param.InitialData = null;
            return(Json(true));
        }
        /// <summary>
        /// Authority screen CTS230
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ActionResult CTS230_Authority(CTS230_ScreenParameter param)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                ICommonHandler comhand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (comhand.IsSystemSuspending())
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                if (!CheckUserPermission(ScreenID.C_SCREEN_ID_PROJ_NEW, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(InitialScreenEnvironment <CTS230_ScreenParameter>("CTS230", param, res));
        }
 /// <summary>
 /// Get customer data from session
 /// </summary>
 /// <returns></returns>
 public ActionResult CTS230_GetCustomer()
 {
     try
     {
         CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>();
         if (param != null)
         {
             if (param.InitialData != null)
             {
                 return(Json(param.InitialData.doCustomer));
             }
         }
         return(null);
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// Set customer data to session
        /// </summary>
        /// <param name="cust"></param>
        /// <returns></returns>
        public ActionResult CTS230_SetDoCustomer(doCustomer cust)
        {
            try
            {
                CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>();
                if (param == null)
                {
                    param = new CTS230_ScreenParameter();
                }
                if (param.InitialData == null)
                {
                    param.InitialData = new CTS230_InitialData();
                }
                param.InitialData.doCustomer = cust;

                UpdateScreenObject(param);
                return(Json(true));
            }
            catch (Exception)
            {
                throw;
            }
        }
        //public bool CTS230_CheckBeforeAddAttachFile(CTS230_AttachFile Cond)
        //{

        //    ObjectResultData res = new ObjectResultData();
        //    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

        //    if (ModelState.IsValid == false)
        //    {
        //        ValidatorUtil.BuildErrorMessage(res, this, null);
        //        //  if (res.IsError)
        //        //return Json(res);
        //    }



        //    return true;
        //}
        #endregion

        /// <summary>
        /// Register new project data
        /// </summary>
        /// <param name="Cond"></param>
        /// <returns></returns>
        public ActionResult CTS230_RegisterNewProject(doRegisterProjectData Cond)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
            ICommonHandler comhand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

            if (comhand.IsSystemSuspending())
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                return(Json(res));
            }

            if (!CheckUserPermission(ScreenID.C_SCREEN_ID_PROJ_NEW, FunctionID.C_FUNC_ID_OPERATE))
            {
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063);
                return(Json(res));
            }

            CTS230_ProjectPurchaseCustomer Customer = CommonUtil.CloneObject <tbt_ProjectPurchaserCustomer, CTS230_ProjectPurchaseCustomer>(Cond.doTbt_ProjectPurchaserCustomer);
            tbt_Project_CTS230             Project  = CommonUtil.CloneObject <tbt_Project_CTS230, tbt_Project_CTS230>(Cond.doTbt_Project);

            ValidatorUtil.BuildErrorMessage(res, new object[] { Project, Customer }, null, false);
            if (res.IsError)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                return(Json(res));
            }
            CTS230_doValidateEmpNo EmpError = CTS230_ValidateEmployee(Cond.doTbt_Project);

            if (EmpError.isError)
            {
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0095, new string[] { EmpError.EmpNo }, new string[] { EmpError.controls });
                return(Json(res));
            }

            #region Line-up type

            if (Cond.doTbt_ProjectExpectedInstrumentDetail != null)
            {
                foreach (tbt_ProjectExpectedInstrumentDetails inst in Cond.doTbt_ProjectExpectedInstrumentDetail)
                {
                    if (inst.LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_STOP_SALE ||
                        inst.LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_ONE_TIME ||
                        inst.LineUpTypeCode == LineUpType.C_LINE_UP_TYPE_TEMPORARY)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3296);
                        res.MessageType = MessageModel.MESSAGE_TYPE.WARNING_DIALOG_LIST;
                        break;
                    }
                }
            }

            #endregion

            CTS230_ScreenParameter param = GetScreenObject <CTS230_ScreenParameter>();
            if (param != null)
            {
                if (param.InitialData != null)
                {
                    Cond.doTbt_ProjectPurchaserCustomer = param.InitialData.doProjectPurchaserData;
                }
            }
            param.InitialData.doRegisterData = new doRegisterProjectData();
            param.InitialData.doRegisterData = Cond;

            UpdateScreenObject(param);
            res.ResultData = true;
            return(Json(res));
        }