Example #1
0
        /// <summary>
        /// Update data to database when click [Confirm] button in ‘Action button’ section
        /// </summary>
        /// <param name="doValidateBusiness"></param>
        /// <returns></returns>
        public ActionResult ConfirmClick_CTS061(CTS061_DOValidateBusiness doValidateBusiness)
        {
            ObjectResultData res = new ObjectResultData();
            ObjectResultData resValidateBusiness = new ObjectResultData();

            ICommonHandler       commonHandler;
            ISaleContractHandler saleContractHandler;

            CTS061_ScreenParameter session;

            try
            {
                session             = CTS061_GetImportData();
                commonHandler       = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                saleContractHandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;

                //3.1 Check suspending
                if (commonHandler.IsSystemSuspending())
                {
                    res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049, "");
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                //3.2 Validate business
                resValidateBusiness = ValidateBusiness_CTS061(doValidateBusiness);
                if (resValidateBusiness != null)
                {
                    return(Json(resValidateBusiness));
                }

                //3.3 Perform save operation
                session.DSSaleContract.dtTbt_SaleBasic[0].ExpectedInstallCompleteDate = doValidateBusiness.ExpectedInstallCompleteDate;
                if (saleContractHandler.RegisterChangeExpectedInstallationCompleteDate(session.DSSaleContract))
                {
                    //3.4 Show success message
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.ResultData  = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, "");
                    return(Json(res));
                }
            }
            catch (Exception ex)
            {
                res.ResultData = false;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Example #2
0
        /// <summary>
        /// Validate required field and business when click [Register] button in ‘Action button’ section
        /// </summary>
        /// <param name="doValidateBusiness"></param>
        /// <returns></returns>
        public ActionResult RegisterClick_CTS061(CTS061_DOValidateBusiness doValidateBusiness) //1.3 Validate required field
        {
            ObjectResultData res = new ObjectResultData();
            ObjectResultData resValidateBusiness = new ObjectResultData();

            ICommonHandler commonHandler;

            try
            {
                //1.1 Check suspending
                commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                if (commonHandler.IsSystemSuspending())
                {
                    res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049, "");
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }

                res = ValidateRequireField_CTS061();
                if (res.IsError)
                {
                    return(Json(res));
                }

                //1.4 Validate business
                resValidateBusiness = ValidateBusiness_CTS061(doValidateBusiness);
                if (resValidateBusiness != null)
                {
                    return(Json(resValidateBusiness));
                }
            }
            catch (Exception ex)
            {
                res.ResultData = false;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Example #3
0
        /// <summary>
        /// Validate business of screen
        /// </summary>
        /// <param name="doValidateBusiness"></param>
        /// <returns></returns>
        public ObjectResultData ValidateBusiness_CTS061(CTS061_DOValidateBusiness doValidateBusiness)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                //DateTime future = new DateTime(DateTime.Now.Year+3, DateTime.Now.Month, DateTime.Now.Day);
                DateTime future = DateTime.Today.AddYears(3);
                if (doValidateBusiness.ExpectedInstallCompleteDate.Value.Date > future)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.ResultData  = MessageUtil.GetMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3206, "");
                    res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3206);
                    return(res);
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(null);
        }