/// <summary>
        /// Validate employee data
        /// </summary>
        /// <param name="Project"></param>
        /// <returns></returns>
        public CTS230_doValidateEmpNo CTS230_ValidateEmployee(tbt_Project_CTS230 Project)
        {
            ObjectResultData res = new ObjectResultData();

            List <tbm_Employee> dtEmp = new List <tbm_Employee>();

            if (!CommonUtil.IsNullOrEmpty(Project.HeadSalesmanEmpNo))
            {
                tbm_Employee tmp = new tbm_Employee();
                tmp.EmpNo = Project.HeadSalesmanEmpNo;
                dtEmp.Add(tmp);
            }
            if (!CommonUtil.IsNullOrEmpty(Project.ProjectManagerEmpNo))
            {
                tbm_Employee tmp = new tbm_Employee();
                tmp.EmpNo = Project.ProjectManagerEmpNo;
                dtEmp.Add(tmp);
            }
            if (!CommonUtil.IsNullOrEmpty(Project.ProjectSubManagerEmpNo))
            {
                tbm_Employee tmp = new tbm_Employee();
                tmp.EmpNo = Project.ProjectSubManagerEmpNo;
                dtEmp.Add(tmp);
            }
            if (!CommonUtil.IsNullOrEmpty(Project.SecurityPlanningChiefEmpNo))
            {
                tbm_Employee tmp = new tbm_Employee();
                tmp.EmpNo = Project.SecurityPlanningChiefEmpNo;
                dtEmp.Add(tmp);
            }
            if (!CommonUtil.IsNullOrEmpty(Project.InstallationChiefEmpNo))
            {
                tbm_Employee tmp = new tbm_Employee();
                tmp.EmpNo = Project.InstallationChiefEmpNo;
                dtEmp.Add(tmp);
            }
            CTS230_doValidateEmpNo      EmpError       = new CTS230_doValidateEmpNo();
            IEmployeeMasterHandler      EmpH           = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler;
            List <doActiveEmployeeList> dtTbm_Employee = EmpH.GetActiveEmployeeList(dtEmp);
            string EmpNo;
            string Controls;

            string Prefix = "sysin";

            if (dtTbm_Employee.Count != dtEmp.Count)
            {
                if (!CommonUtil.IsNullOrEmpty(Project.HeadSalesmanEmpNo) &&
                    !dtTbm_Employee.Any(a => a.EmpNo == Project.HeadSalesmanEmpNo))
                {
                    EmpNo             = Project.HeadSalesmanEmpNo;
                    Controls          = Prefix + "HeadSalesmanEmpNo";
                    EmpError.EmpNo    = EmpNo;
                    EmpError.controls = Controls;
                    return(EmpError);
                }
                if (!CommonUtil.IsNullOrEmpty(Project.ProjectManagerEmpNo) &&
                    !dtTbm_Employee.Any(a => a.EmpNo == Project.ProjectManagerEmpNo))
                {
                    EmpNo             = Project.ProjectManagerEmpNo;
                    Controls          = Prefix + "ProjectManagerEmpNo";
                    EmpError.EmpNo    = EmpNo;
                    EmpError.controls = Controls;
                    return(EmpError);
                }
                if (!CommonUtil.IsNullOrEmpty(Project.ProjectSubManagerEmpNo) &&
                    !dtTbm_Employee.Any(a => a.EmpNo == Project.ProjectSubManagerEmpNo))
                {
                    EmpNo             = Project.ProjectSubManagerEmpNo;
                    Controls          = Prefix + "ProjectSubManagerEmpNo";
                    EmpError.EmpNo    = EmpNo;
                    EmpError.controls = Controls;
                    return(EmpError);
                }
                if (!CommonUtil.IsNullOrEmpty(Project.SecurityPlanningChiefEmpNo) &&
                    !dtTbm_Employee.Any(a => a.EmpNo == Project.SecurityPlanningChiefEmpNo))
                {
                    EmpNo             = Project.SecurityPlanningChiefEmpNo;
                    Controls          = Prefix + "SecurityPlanningChiefEmpNo";
                    EmpError.EmpNo    = EmpNo;
                    EmpError.controls = Controls;
                    return(EmpError);
                }
                if (!CommonUtil.IsNullOrEmpty(Project.InstallationChiefEmpNo) &&
                    !dtTbm_Employee.Any(a => a.EmpNo == Project.InstallationChiefEmpNo))
                {
                    EmpNo             = Project.InstallationChiefEmpNo;
                    Controls          = Prefix + "InstallationChiefEmpNo";
                    EmpError.EmpNo    = EmpNo;
                    EmpError.controls = Controls;
                    return(EmpError);
                }
            }
            return(new CTS230_doValidateEmpNo());
        }
        //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));
        }