Exemplo n.º 1
0
        /// <summary>
        /// Method to pass xCBL XML data to the web serivce
        /// </summary>
        /// <param name="currentOperationContext">Operation context inside this XmlElement the xCBL XML data to parse</param>
        /// <returns>XElement - XML Message Acknowledgement response indicating Success or Failure</returns>
        internal MeridianResult ProcessShippingScheduleResponseRequest(OperationContext currentOperationContext)
        {
            _meridianResult        = new MeridianResult();
            _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS;

            XCBL_User xCblServiceUser = new XCBL_User();

            //MeridianSystemLibrary.LogTransaction("No WebUser", "No FTPUser", "ProcessShippingScheduleResponseDocument", "01.01", "Success - New SOAP Request Received", "Shipping Schedule Response Process", "No FileName", "No Schedule ID", "No Order Number", null, "Success");
            if (CommonProcess.IsAuthenticatedRequest(currentOperationContext, ref xCblServiceUser))
            {
                //MeridianSystemLibrary.LogTransaction(xCblServiceUser.WebUsername, xCblServiceUser.FtpUsername, "IsAuthenticatedRequest", "01.02", "Success - Authenticated request", "Shipping Schedule Response Process", "No FileName", "No Schedule ID", "No Order Number", null, "Success");
                ProcessData processData = ProcessRequestAndCreateFiles(currentOperationContext, xCblServiceUser);
                if (processData == null || string.IsNullOrEmpty(processData.ScheduleResponseID) || string.IsNullOrEmpty(processData.OrderNumber))
                {
                    _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                }
                else
                {
                    processData.FtpUserName            = xCblServiceUser.FtpUsername;
                    processData.FtpPassword            = xCblServiceUser.FtpPassword;
                    processData.FtpServerInFolderPath  = xCblServiceUser.FtpServerInFolderPath;
                    processData.FtpServerOutFolderPath = xCblServiceUser.FtpServerOutFolderPath;
                    processData.LocalFilePath          = xCblServiceUser.LocalFilePath;
                    _meridianResult.WebUserName        = xCblServiceUser.WebUsername;
                    _meridianResult.WebPassword        = xCblServiceUser.WebPassword;
                    _meridianResult.WebHashKey         = xCblServiceUser.Hashkey;

                    if (!CreateLocalCsvFile(processData))
                    {
                        _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                    }
                    _meridianResult.UniqueID = processData.ScheduleResponseID;
                    return(_meridianResult);
                }
            }
            else
            {
                _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                //MeridianSystemLibrary.LogTransaction("No WebUser", "No FTPUser", "IsAuthenticatedRequest", "03.01", "Error - New SOAP Request not authenticated", "UnAuthenticated Request", "No FileName", "No Schedule ID", "No Order Number", null, "Error 03.01 - Incorrect Credential");
            }
            return(_meridianResult);
        }
        internal MeridianResult ProcessDocument(OperationContext currentOperationContext)
        {
            _meridianResult        = new MeridianResult();
            _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_SUCCESS;

            XCBL_User xCblServiceUser = new XCBL_User();

            ProcessData processDatatest = ProcessRequestAndCreateFiles(currentOperationContext, xCblServiceUser);

            if (processDatatest != null)
            {
                WriteScheduleShippingXmlDocument(currentOperationContext.RequestContext);
            }


            if (CommonProcess.IsAuthenticatedRequest(currentOperationContext, ref xCblServiceUser))
            {
                ApplicationError.WriteMessage("AuthenticatedRequest Sucess - New SOAP Request authenticated.");
                ProcessData processData = ProcessRequestAndCreateFiles(currentOperationContext, xCblServiceUser);
                if (processData == null || string.IsNullOrEmpty(processData.ScheduleID) || string.IsNullOrEmpty(processData.OrderNumber))
                {
                    _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                }
                else
                {
                    if (!UpdateToServer(processData))
                    {
                        // ApplicationError.WriteMessage("NOT FOUND Order Ref Number For Process Is " + processData.ShippingSchedule.OrderNumber);
                        _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                    }
                    _meridianResult.UniqueID = processData.ScheduleID;
                    return(_meridianResult);
                }
            }
            else
            {
                _meridianResult.Status = MeridianGlobalConstants.MESSAGE_ACKNOWLEDGEMENT_FAILURE;
                ApplicationError.WriteMessage("Error - New SOAP Request not authenticated. UnAuthenticated Request");
            }
            return(_meridianResult);
        }