Exemple #1
0
        /// <summary>
        /// Validate Business when click [Register] button in ‘Action button’ section
        /// </summary>
        /// <param name="doCTS054RegisterData"></param>
        /// <returns></returns>
        public ActionResult ValidateALL_CTS054(CTS054_DOValidateBusiness doCTS054RegisterData)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                res = ValidateSystemSuspending_CTS054();
                if (res.ResultData != null)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                //if (ModelState.IsValid == false)
                //{
                //    ValidatorUtil.BuildErrorMessage(res, this);
                //    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                //    res.ResultData = true;

                //    if (res.IsError)
                //        return Json(res);
                //}
                if (!doCTS054RegisterData.ExpectedOperationDate.HasValue)
                {
                    res.ResultData  = false;
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0007, new string[] { CommonUtil.GetLabelFromResource("Common", "_ContractRegisterChange", "lblExpectOperationDate") }, new string[] { "dpExpectOperationDate" });
                    return(Json(res));
                }

                res = ValidateBusiness_CTS054(doCTS054RegisterData);
                if (res.ResultData != null)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Exemple #2
0
        /// <summary>
        /// Update data to database when click [Confirm] button in ‘Action button’ section
        /// </summary>
        /// <param name="doCTS"></param>
        /// <returns></returns>
        public ActionResult ConfirmClick_CTS054(CTS054_DOValidateBusiness doCTS)
        {
            IUserControlHandler              userHandler;
            IRentralContractHandler          renderHandler;
            ObjectResultData                 res = new ObjectResultData();
            dtTbt_RentalContractBasicForView dtTbt_RentalContractBasicForView;
            dsRentalContractData             dsRentalContract;

            CTS054_ScreenParameter session;

            try
            {
                session       = CTS054_GetImportData();
                userHandler   = ServiceContainer.GetService <IUserControlHandler>() as IUserControlHandler;
                renderHandler = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler;

                dtTbt_RentalContractBasicForView = renderHandler.GetTbt_RentalContractBasicForView(doCTS.ContractCode.Trim())[0];
                dsRentalContract = session.DSRentalContract;

                dsRentalContract.dtTbt_RentalSecurityBasic[0].ChangeImplementDate     = doCTS.ExpectedOperationDate;
                dsRentalContract.dtTbt_RentalContractBasic[0].LastChangeImplementDate = doCTS.ExpectedOperationDate;

                if (dtTbt_RentalContractBasicForView.ContractStatus == SECOM_AJIS.Common.Util.ConstantValue.ContractStatus.C_CONTRACT_STATUS_BEF_START)
                {
                    dsRentalContract.dtTbt_RentalSecurityBasic[0].ExpectedOperationDate = doCTS.ExpectedOperationDate;
                }

                if (dtTbt_RentalContractBasicForView.ContractStatus == SECOM_AJIS.Common.Util.ConstantValue.ContractStatus.C_CONTRACT_STATUS_AFTER_START)
                {
                    dsRentalContract.dtTbt_RentalSecurityBasic[0].ExpectedInstallationCompleteDate = doCTS.ExpectedOperationDate;
                }

                renderHandler.RegisterExpectedOperationDate(dsRentalContract);
                res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, "");
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Exemple #3
0
        /// <summary>
        /// Validate Business of screen
        /// </summary>
        /// <param name="doValidateBusiness"></param>
        /// <returns></returns>
        public ObjectResultData ValidateBusiness_CTS054(CTS054_DOValidateBusiness doValidateBusiness)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                if (doValidateBusiness.ExpectedOperationDate <= DateTime.Now.Date)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.ResultData  = MessageUtil.GetMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3015, "");
                    res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3015);
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(res);
        }