コード例 #1
0
        ///<summary>
        ///Purpose   : Update quotation data when action type = 4 (cancel)
        ///Parameters:  doUpdateQuotationData
        ///                - QuotationTargetCode = Q0000000536
        ///                - Alphabet = NULL
        ///                - LastUpdateDate = NULL
        ///                - ContractCode = NULL
        ///                - ActionTypeCode = 4
        ///Expected  : See expectation test case14
        ///</summary>
        public string Case14()
        {
            IQuotationHandler     target   = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler;
            doUpdateQuotationData doUpdate = new doUpdateQuotationData();

            doUpdate.QuotationTargetCode = "Q0000000536";
            doUpdate.Alphabet            = null;
            doUpdate.LastUpdateDate      = DateTime.MinValue;
            doUpdate.ContractCode        = null;
            doUpdate.ActionTypeCode      = "4";
            string expected = "1";
            string actual;

            try
            {
                //Login user = 510729
                //Process datetime = 2011-11-19  10:30:00.000
                CommonUtil.dsTransData.dtUserData.EmpNo = "510729";
                CommonUtil.dsTransData.dtOperationData.ProcessDateTime = new DateTime(2011, 11, 19, 10, 30, 00);

                CommonUtil.dsTransData.dtOperationData.GUID = "Case14";
                int result = target.UpdateQuotationData(doUpdate);
                actual = result.ToString();
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 14, expected, actual, CompareResult_String(expected, actual)));
        }
コード例 #2
0
        ///<summary>
        ///Purpose   : Mandatory check1 (How does the system perform if action type is not specified.)
        ///Parameters:  doUpdateQuotationData
        ///                - QuotationTargetCode = NULL
        ///                - Alphabet = NULL
        ///                - LastUpdateDate = NULL
        ///                - ContractCode = NULL
        ///                - ActionTypeCode = NULL
        ///Expected  : MSG0007: These field was required: ActionTypeCode.
        ///</summary>
        public string Case1()
        {
            IQuotationHandler     target   = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler;
            doUpdateQuotationData doUpdate = new doUpdateQuotationData();

            doUpdate.QuotationTargetCode = null;
            doUpdate.Alphabet            = null;
            doUpdate.LastUpdateDate      = DateTime.MinValue;
            doUpdate.ContractCode        = null;
            doUpdate.ActionTypeCode      = null;
            string expected = "MSG0007";
            string actual;

            try
            {
                int result = target.UpdateQuotationData(doUpdate);
                actual = result.ToString();
            }
            catch (ApplicationErrorException ex)
            {
                actual = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 1, expected, actual, CompareResult_String(expected, actual)));
        }
コード例 #3
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            doUpdateQuotationData qt = validationContext.ObjectInstance as doUpdateQuotationData;

            if (qt.ActionTypeCode == ActionType.C_ACTION_TYPE_APPROVE || qt.ActionTypeCode == ActionType.C_ACTION_TYPE_CHANGE)
            {
                if (CommonUtil.IsNullOrEmpty(value))
                {
                    return(base.IsValid(value, validationContext));
                }
            }
            return(null);
        }
コード例 #4
0
        /// <summary>
        /// Update data to database when click [Confirm] button in ‘Action button’ section
        /// </summary>
        /// <param name="doCancalReason"></param>
        /// <returns></returns>
        public ActionResult CTS090_ConfirmRegisterCancelData(CTS090_doCancelReason doCancalReason)
        {
            ObjectResultData res = new ObjectResultData();
            CTS090_RegisterCancelTargetData registerCancelData;
            List <tbt_SaleBasic>            tbt_SaleBasicList;
            ISaleContractHandler            saleHandler;
            IBillingTempHandler             billingHandler;
            List <tbt_BillingTemp>          tbt_BillingTempList;
            IQuotationHandler     guotHandler;
            doUpdateQuotationData doUpdateQuotation;

            try
            {
                //CheckSystemStatus
                if (CheckIsSuspending(res) == true)
                {
                    return(Json(res));
                }

                //Check screen permission
                if (CheckUserPermission(ScreenID.C_SCREEN_ID_CANCEL_SALE_CONTRACT, FunctionID.C_FUNC_ID_OPERATE) == false)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }


                //ValidateScreenBusiness
                res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                if (doCancalReason.CancelDate > DateTime.Now.Date)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3154, null, new string[] { "dpCancelDate" });
                    return(Json(res));
                }

                //ValidateDataBusiness
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                ValidateDataBusiness_CTS090(res);
                if (res.IsError)
                {
                    return(Json(res));
                }


                CTS090_ScreenParameter sParam = GetScreenObject <CTS090_ScreenParameter>();
                using (TransactionScope scope = new TransactionScope())
                {
                    /*--- RegisterCancelContract ---*/
                    saleHandler        = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                    registerCancelData = sParam.CTS090_Session;
                    if (registerCancelData.RegisterCancelData != null)
                    {
                        string strContractCode        = registerCancelData.RegisterCancelData.ContractCode;
                        string strOCCCode             = registerCancelData.RegisterCancelData.OCC;
                        string strQuotationTargetCode = registerCancelData.RegisterCancelData.QuotationTargetCode;
                        string strAlphabet            = registerCancelData.RegisterCancelData.Alphabet;

                        //MapSaleContractData
                        bool isUpdateQuotation = false;
                        if (registerCancelData.RegisterCancelData.ChangeType == SaleChangeType.C_SALE_CHANGE_TYPE_NEW_SALE)
                        {
                            registerCancelData.RegisterCancelData.ContractStatus = ContractStatus.C_CONTRACT_STATUS_CANCEL;
                            isUpdateQuotation = true;
                        }
                        registerCancelData.RegisterCancelData.OCC        = registerCancelData.InitialData.OCCCode;
                        registerCancelData.RegisterCancelData.ChangeType = SaleChangeType.C_SALE_CHANGE_TYPE_CANCEL;
                        registerCancelData.RegisterCancelData.SaleProcessManageStatus = SaleProcessManageStatus.C_SALE_PROCESS_STATUS_CANCEL;
                        registerCancelData.RegisterCancelData.ApproveNo1          = doCancalReason.ApproveNo1;
                        registerCancelData.RegisterCancelData.CancelReasonType    = doCancalReason.CancelReasonType;
                        registerCancelData.RegisterCancelData.CancelDate          = doCancalReason.CancelDate;
                        registerCancelData.RegisterCancelData.CancelProcessDate   = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
                        registerCancelData.RegisterCancelData.ChangeImplementDate = doCancalReason.CancelDate;

                        //Save cancel contract data
                        tbt_SaleBasicList = saleHandler.UpdateTbt_SaleBasic(registerCancelData.RegisterCancelData);

                        //Delete billing temp
                        billingHandler      = ServiceContainer.GetService <IBillingTempHandler>() as IBillingTempHandler;
                        tbt_BillingTempList = billingHandler.DeleteBillingTempByContractCodeOCC(strContractCode, strOCCCode);

                        //Lock quotation
                        guotHandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler;
                        bool isLockQuotComplete = guotHandler.LockQuotation(strQuotationTargetCode, strAlphabet, LockStyle.C_LOCK_STYLE_ALL);

                        if (isUpdateQuotation)
                        {
                            //Update quotation data
                            doUpdateQuotation = new doUpdateQuotationData();
                            doUpdateQuotation.QuotationTargetCode = strQuotationTargetCode;
                            doUpdateQuotation.Alphabet            = strAlphabet;
                            doUpdateQuotation.LastUpdateDate      = DateTime.MinValue; //null;
                            doUpdateQuotation.ContractCode        = strContractCode;
                            doUpdateQuotation.ActionTypeCode      = ActionType.C_ACTION_TYPE_CANCEL;
                            int iUpdateQuotRowCount = guotHandler.UpdateQuotationData(doUpdateQuotation);
                        }

                        //Delete installation basic
                        IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler;
                        bool blnProcessResult = installHandler.DeleteInstallationBasicData(strContractCode);

                        //Cancel book
                        IInventoryHandler inventHandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                        doBooking         booking       = new doBooking();
                        booking.ContractCode = registerCancelData.RegisterCancelData.ContractCode;
                        bool isCancelBookComplete = inventHandler.CancelBooking(booking);
                    }
                    /*--------------------------*/

                    scope.Complete();
                    res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046);
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }