private ProcessData ProcessRequestAndCreateFiles(OperationContext operationContext, XCBL_User xCblServiceUser)
        {
            try
            {
                ProcessData processData = ValidateScheduleShippingXmlDocument(operationContext.RequestContext, xCblServiceUser);
                if (processData != null && !string.IsNullOrEmpty(processData.ScheduleID) && !string.IsNullOrEmpty(processData.OrderNumber))
                {
                    if (UsePBSServiceDataAndUpdateFlags(processData))
                    {
                        return(processData);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationError.logErrors(ex);
                ApplicationError.logErrors(ex, "ProcessRequestAndCreateFiles");
            }

            return(new ProcessData());
        }
示例#2
0
        public static int UpdateDataToLocal(ProcessData processData)
        {
            try
            {
                int result = 0;

                using (SqlConnection sqlConnection = new SqlConnection(MeridianGlobalConstants.XCBL_DATABASE_SERVER_URL))
                {
                    sqlConnection.Open();
                    using (SqlCommand sqlCommand = new SqlCommand("IMPORT_AWC_xCBL", sqlConnection))
                    {
                        sqlCommand.CommandType = CommandType.StoredProcedure;

                        sqlCommand.Parameters.Add("@trackingnum", SqlDbType.NVarChar).Value = processData.ShippingSchedule.OrderNumber;
                        sqlCommand.Parameters.Add("@firststop", SqlDbType.NVarChar).Value   = processData.ShippingSchedule.Other_FirstStop;
                        sqlCommand.Parameters.Add("@before7", SqlDbType.NVarChar).Value     = processData.ShippingSchedule.Other_Before7;
                        sqlCommand.Parameters.Add("@before9", SqlDbType.NVarChar).Value     = processData.ShippingSchedule.Other_Before9;
                        sqlCommand.Parameters.Add("@before12", SqlDbType.NVarChar).Value    = processData.ShippingSchedule.Other_Before12;
                        sqlCommand.Parameters.Add("@sameday", SqlDbType.NVarChar).Value     = processData.ShippingSchedule.Other_SameDay;
                        sqlCommand.Parameters.Add("@homeowner", SqlDbType.NVarChar).Value   = processData.ShippingSchedule.Other_OwnerOccupied;
                        sqlCommand.Parameters.Add("@lat", SqlDbType.NVarChar).Value         = processData.ShippingSchedule.Latitude.ToString();
                        sqlCommand.Parameters.Add("@long", SqlDbType.NVarChar).Value        = processData.ShippingSchedule.Longitude.ToString();
                        sqlCommand.Parameters.Add("@name", SqlDbType.NVarChar).Value        = processData.ShippingSchedule.Name1;
                        sqlCommand.Parameters.Add("@address1", SqlDbType.NVarChar).Value    = processData.ShippingSchedule.Street;
                        sqlCommand.Parameters.Add("@address2", SqlDbType.NVarChar).Value    = processData.ShippingSchedule.StreetSupplement1;
                        sqlCommand.Parameters.Add("@city", SqlDbType.NVarChar).Value        = processData.ShippingSchedule.City;
                        //sqlCommand.Parameters.Add("@state", SqlDbType.NVarChar).Value = webPassword;
                        sqlCommand.Parameters.Add("@zip", SqlDbType.NVarChar).Value     = processData.ShippingSchedule.PostalCode;
                        sqlCommand.Parameters.Add("@phone", SqlDbType.NVarChar).Value   = processData.ShippingSchedule.ContactNumber_1;
                        sqlCommand.Parameters.Add("@notes", SqlDbType.NVarChar).Value   = processData.ShippingSchedule.ShippingInstruction;
                        sqlCommand.Parameters.Add("@contact", SqlDbType.NVarChar).Value = processData.ShippingSchedule.ContactName;
                        // Fill the data adapter with the sql query results
                        //sqlConnection.Open();
                        result = sqlCommand.ExecuteNonQuery();
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                // If there was an error encountered in retrieving the authentication record then try to insert a record in MER010TransactionLog table to record the issue
                try
                {
                    ApplicationError.logErrors(ex, "UpdateDataToLocal");
                }
                catch
                {
                }
                return(0);
            }
        }
示例#3
0
        public static ProcessData GetNewProcessData(this XCBL_User xCblServiceUser)
        {
            var processData = new ProcessData
            {
                ScheduleID         = "No Schedule Id",
                RequisitionID      = "No Requisition Id",
                ScheduleResponseID = "No Schedule Response Id",
                OrderNumber        = "No Order Number",
                CsvFileName        = "No FileName",
                XmlFileName        = "No FileName",
                ShippingSchedule   = new ShippingSchedule(),
                // Requisition = new Requisition(),
                ShippingScheduleResponse = new ShippingScheduleResponse()
                                           //WebUserName = xCblServiceUser.WebUsername,
                                           //FtpUserName = xCblServiceUser.FtpUsername
            };

            return(processData);
        }
示例#4
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);
        }
示例#6
0
        /// <summary>
        /// To Process request and create csv and xml files.
        /// </summary>
        /// <param name="operationContext">Current OperationContext</param>
        /// <returns></returns>
        private ProcessData ProcessRequestAndCreateFiles(OperationContext operationContext, XCBL_User xCblServiceUser)
        {
            try
            {
                ProcessData processData = ValidateScheduleShippingResponseXmlDocument(operationContext.RequestContext, xCblServiceUser);
                if (processData != null && !string.IsNullOrEmpty(processData.ScheduleResponseID) &&
                    !string.IsNullOrEmpty(processData.OrderNumber) &&
                    !string.IsNullOrEmpty(processData.CsvFileName))

                {
                    //MeridianSystemLibrary.LogTransaction(xCblServiceUser.WebUsername, xCblServiceUser.FtpUsername, "ProcessRequestAndCreateFiles", "01.03", string.Format("Success - Parsed requested xml for CSV file {0}", processData.ScheduleResponseID), "Shipping Schedule Response Process", processData.CsvFileName, processData.ScheduleResponseID, processData.OrderNumber, processData.XmlDocument, "Success");
                    return(processData);
                }
            }
            catch (Exception ex)
            {
                // MeridianSystemLibrary.LogTransaction(xCblServiceUser.WebUsername, xCblServiceUser.FtpUsername, "ValidateScheduleShippingXmlDocument", "03.02", "Error - Incorrect request ", string.Format("Exception - Invalid request xml {0}", ex.Message), "No file Name", "No Schedule Id", "No Order Number", null, "Error 03.02 - Invalid request xml");
            }

            return(new ProcessData());
        }
示例#7
0
        /// <summary>
        /// To create CSV file
        /// </summary>
        /// <param name="processData">Process data</param>
        /// <returns></returns>
        private bool CreateLocalCsvFile(ProcessData processData)
        {
            bool result = false;

            try
            {
                if (processData != null && !string.IsNullOrEmpty(processData.ScheduleResponseID) &&
                    !string.IsNullOrEmpty(processData.OrderNumber) &&
                    !string.IsNullOrEmpty(processData.CsvFileName))
                {
                    var record = string.Format(MeridianGlobalConstants.SHIPPING_SCHEDULE_RESPONSE_CSV_HEADER_NAMES_FORMAT,
                                               processData.ShippingScheduleResponse.ScheduleResponseID, processData.ShippingScheduleResponse.ScheduleResponseIssueDate, processData.ShippingScheduleResponse.ScheduleResponseOrderNumber, processData.ShippingScheduleResponse.ScheduleResponsePurposeCoded, processData.ShippingScheduleResponse.ScheduleResponseTypeCoded, "",
                                               processData.ShippingScheduleResponse.ScheduleID, processData.ShippingScheduleResponse.ScheduleIssuedDate, processData.ShippingScheduleResponse.OrderNumber, processData.ShippingScheduleResponse.SequenceNumber,
                                               processData.ShippingScheduleResponse.Other_FirstStop, processData.ShippingScheduleResponse.Other_Before7, processData.ShippingScheduleResponse.Other_Before9, processData.ShippingScheduleResponse.Other_Before12, processData.ShippingScheduleResponse.Other_SameDay, processData.ShippingScheduleResponse.Other_OwnerOccupied, processData.ShippingScheduleResponse.Other_7, processData.ShippingScheduleResponse.Other_8, processData.ShippingScheduleResponse.Other_9, processData.ShippingScheduleResponse.Other_10,
                                               processData.ShippingScheduleResponse.PurposeCoded, processData.ShippingScheduleResponse.ScheduleType, processData.ShippingScheduleResponse.AgencyCoded, processData.ShippingScheduleResponse.Name1, processData.ShippingScheduleResponse.Street, processData.ShippingScheduleResponse.StreetSupplement1, processData.ShippingScheduleResponse.PostalCode, processData.ShippingScheduleResponse.City, processData.ShippingScheduleResponse.RegionCoded,
                                               processData.ShippingScheduleResponse.ContactName, processData.ShippingScheduleResponse.ContactNumber_1, processData.ShippingScheduleResponse.ContactNumber_2, processData.ShippingScheduleResponse.ContactNumber_3, processData.ShippingScheduleResponse.ContactNumber_4, processData.ShippingScheduleResponse.ContactNumber_5, processData.ShippingScheduleResponse.ContactNumber_6,
                                               processData.ShippingScheduleResponse.ShippingInstruction, processData.ShippingScheduleResponse.GPSSystem, processData.ShippingScheduleResponse.Latitude.ToString(), processData.ShippingScheduleResponse.Longitude.ToString(), processData.ShippingScheduleResponse.LocationID, processData.ShippingScheduleResponse.EstimatedArrivalDate, processData.ShippingScheduleResponse.OrderType);
                    StringBuilder strBuilder = new StringBuilder(MeridianGlobalConstants.SHIPPING_SCHEDULE_RESPONSE_CSV_HEADER_NAMES);
                    strBuilder.AppendLine();
                    strBuilder.AppendLine(record);
                    string csvContent = strBuilder.ToString();

                    _meridianResult.FtpUserName            = processData.FtpUserName;
                    _meridianResult.FtpPassword            = processData.FtpPassword;
                    _meridianResult.FtpServerInFolderPath  = processData.FtpServerInFolderPath;
                    _meridianResult.FtpServerOutFolderPath = processData.FtpServerOutFolderPath;
                    _meridianResult.LocalFilePath          = processData.LocalFilePath;
                    _meridianResult.WebUserName            = processData.WebUserName;
                    _meridianResult.UniqueID    = processData.ScheduleResponseID;
                    _meridianResult.OrderNumber = processData.OrderNumber;
                    _meridianResult.FileName    = processData.CsvFileName;

                    if (MeridianGlobalConstants.CONFIG_CREATE_LOCAL_CSV == MeridianGlobalConstants.SHOULD_CREATE_LOCAL_FILE)
                    {
                        _meridianResult.UploadFromLocalPath = true;
                        return(CommonProcess.CreateFile(csvContent, _meridianResult));
                    }
                    else
                    {
                        byte[] content = Encoding.UTF8.GetBytes(csvContent);
                        int    length  = content.Length;

                        if (!string.IsNullOrEmpty(processData.CsvFileName) && length > 40)
                        {
                            _meridianResult.Content = content;
                            result = true;
                        }
                        else
                        {
                            // MeridianSystemLibrary.LogTransaction(processData.WebUserName, processData.FtpUserName, "CreateLocalCsvFile", "03.06", ("Error - Creating CSV File because of Stream " + length), string.Format("Error - Creating CSV File {0} with error of Stream", processData.CsvFileName), processData.CsvFileName, processData.ScheduleResponseID, processData.OrderNumber, processData.XmlDocument, "Error 03.06 - Create CSV File");
                        }
                    }
                }
                else
                {
                    // MeridianSystemLibrary.LogTransaction(processData.WebUserName, processData.FtpUserName, "CreateLocalCsvFile", "03.06", "Error - Creating CSV File because of Process DATA", string.Format("Error - Creating CSV File {0} with error of Process DATA", processData.CsvFileName), processData.CsvFileName, processData.ScheduleResponseID, processData.OrderNumber, processData.XmlDocument, "Error 03.06 - Create CSV File");
                }
            }
            catch (Exception ex)
            {
                // MeridianSystemLibrary.LogTransaction(processData.WebUserName, processData.FtpUserName, "CreateLocalCsvFile", "03.06", "Error - Creating CSV File", string.Format("Error - Creating CSV File {0} with error {1}", processData.CsvFileName, ex.Message), processData.CsvFileName, processData.ScheduleResponseID, processData.OrderNumber, processData.XmlDocument, "Error 03.06 - Create CSV File");
            }

            return(result);
        }
示例#8
0
        /// <summary>
        /// To get transportion data
        /// </summary>
        /// <param name="xmlNsManager"> XmlNamespaceManager </param>
        /// <param name="element">Main xml node from requested data </param>
        /// <param name="processData">Process data</param>
        private void GetListOfTransportRouting(XmlNamespaceManager xmlNsManager, XmlNode element, ProcessData processData)
        {
            XmlNode shippingInstruction = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_SHIPPING_INSTRUCTIONS, "15", processData, processData.ScheduleResponseID);

            if (shippingInstruction != null)
            {
                processData.ShippingScheduleResponse.ShippingInstruction = shippingInstruction.InnerText.Replace(",", "").ReplaceSpecialCharsWithSpace();
            }

            XmlNode gpsSystem = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_GPS_SYSTEM, "16", processData, processData.ScheduleResponseID);

            if (gpsSystem != null)
            {
                processData.ShippingScheduleResponse.GPSSystem = gpsSystem.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode latitude = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_LATITUDE, "17", processData, processData.ScheduleResponseID);

            if (latitude != null)
            {
                double dLatitude;
                double.TryParse(latitude.InnerText.ReplaceSpecialCharsWithSpace(), out dLatitude);
                processData.ShippingScheduleResponse.Latitude = dLatitude;
            }

            XmlNode longitude = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_LONGITUDE, "18", processData, processData.ScheduleResponseID);

            if (longitude != null)
            {
                double dLongitude;
                double.TryParse(longitude.InnerText.ReplaceSpecialCharsWithSpace(), out dLongitude);
                processData.ShippingScheduleResponse.Longitude = dLongitude;
            }

            XmlNode locationID = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_LOCATION_ID, "19", processData, processData.ScheduleResponseID);

            if (locationID != null)
            {
                processData.ShippingScheduleResponse.LocationID = locationID.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode estimatedArrivalDate = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_ESTIMATED_ARRIVAL_DATE, "20", processData, processData.ScheduleResponseID);

            if (estimatedArrivalDate != null)
            {
                processData.ShippingScheduleResponse.EstimatedArrivalDate = estimatedArrivalDate.InnerText.ReplaceSpecialCharsWithSpace();
            }
        }
示例#9
0
        /// <summary>
        /// To get List of contacts
        /// </summary>
        /// <param name="xmlNsManager"> XmlNamespaceManager </param>
        /// <param name="element">Main xml node from requested data </param>
        /// <param name="processData">Process data</param>
        private void GetListOfContactNumber(XmlNamespaceManager xmlNsManager, XmlNode element, ProcessData processData)
        {
            var lisOfContactNumber = element.GetNodeByNameAndLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_LIST_OF_CONTACT_NUMBERS, "13", processData, processData.ScheduleResponseID, "GetListOfContactNumber");

            if (lisOfContactNumber != null && lisOfContactNumber.ChildNodes != null)
            {
                XmlNodeList xnlContactNames = lisOfContactNumber.ChildNodes;
                for (int iContactNameIndex = 0; iContactNameIndex < xnlContactNames.Count; iContactNameIndex++)
                {
                    XmlNodeList xnlContactValues = xnlContactNames[iContactNameIndex].ChildNodes;
                    for (int iContactValuesIndex = 0; iContactValuesIndex < xnlContactValues.Count; iContactValuesIndex++)
                    {
                        if (xnlContactValues[iContactValuesIndex].Name.Contains(MeridianGlobalConstants.XCBL_CONTACT_VALUE))
                        {
                            processData.ShippingScheduleResponse.SetContactNumbers(xnlContactValues[iContactValuesIndex].InnerText.ReplaceSpecialCharsWithSpace(), iContactNameIndex);
                        }
                    }
                }
            }
            //else if (lisOfContactNumber.ChildNodes == null)
            //    MeridianSystemLibrary.LogTransaction(processData.WebUserName, processData.FtpUserName, "GetListOfContactNumber", "14", "Warning - The Contact Number Not Found.", "Warning - Contact Number", processData.CsvFileName, processData.ScheduleResponseID, processData.OrderNumber, null, "Warning 14 - Contact Name Not Found");
        }
示例#10
0
        /// <summary>
        /// To get single node value
        /// </summary>
        /// <param name="xmlNsManager"> XmlNamespaceManager </param>
        /// <param name="element">Main xml node from requested data </param>
        /// <param name="processData">Process data</param>
        private void GetPurposeScheduleTypeCodeAndParty(XmlNamespaceManager xmlNsManager, XmlNode element, ProcessData processData)
        {
            XmlNode purposeCoded = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_SCHEDULE_PURPOSE_CODED, "03", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (purposeCoded != null)
            {
                processData.ShippingScheduleResponse.PurposeCoded = purposeCoded.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode scheduleTypeCoded = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_SCHEDULE_TYPE_CODED, "04", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (scheduleTypeCoded != null)
            {
                processData.ShippingScheduleResponse.ScheduleType = scheduleTypeCoded.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode agencyCoded = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_AGENCY_CODED, "05", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (agencyCoded != null)
            {
                processData.ShippingScheduleResponse.AgencyCoded = agencyCoded.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode name1 = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_NAME, "06", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (name1 != null)
            {
                processData.ShippingScheduleResponse.Name1 = name1.InnerText.Replace(",", "").ReplaceSpecialCharsWithSpace();
            }

            XmlNode street = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_STREET, "07", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (street != null)
            {
                processData.ShippingScheduleResponse.Street = street.InnerText.Replace(",", "").ReplaceSpecialCharsWithSpace();
            }

            XmlNode streetSupplement1 = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_STREET_SUPPLEMENT, "08", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (streetSupplement1 != null)
            {
                processData.ShippingScheduleResponse.StreetSupplement1 = streetSupplement1.InnerText.Replace(",", "").ReplaceSpecialCharsWithSpace();
            }

            XmlNode postalCode = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_POSTAL_CODE, "09", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (postalCode != null)
            {
                processData.ShippingScheduleResponse.PostalCode = postalCode.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode city = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_CITY, "10", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (city != null)
            {
                processData.ShippingScheduleResponse.City = city.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode regionCoded = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_REGION_CODED, "11", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (regionCoded != null)
            {
                processData.ShippingScheduleResponse.RegionCoded = regionCoded.InnerText.ReplaceSpecialCharsWithSpace();
            }

            XmlNode contactName = element.GetNodeByNameAndInnerTextLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_CONTACT_NAME, "12", processData, processData.ScheduleResponseID, MeridianGlobalConstants.METHOD_GET_PURPOSE_SCHEDULE_TYPE_CODE_AND_PARTY);

            if (contactName != null)
            {
                processData.ShippingScheduleResponse.ContactName = contactName.InnerText.Replace(",", "").ReplaceSpecialCharsWithSpace();
            }
        }
示例#11
0
        /// <summary>
        /// To get Other schedule references
        /// </summary>
        /// <param name="xmlNsManager"> XmlNamespaceManager </param>
        /// <param name="xnScheduleReferences">ScheduleReferences xml node from requested data </param>
        /// <param name="processData">Process data</param>
        private void GetOtherScheduleReferences(XmlNamespaceManager xmlNsManager, XmlNode xnScheduleReferences, ProcessData processData)
        {
            XmlNode xnOtherScheduleReferences = xnScheduleReferences.GetNodeByNameAndLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_OTHER_SCHEDULE_REFERENCES, "05", processData, processData.ScheduleResponseID, "GetOtherScheduleReferences");

            if (xnOtherScheduleReferences != null)
            {
                XmlNodeList xnReferenceCoded = xnOtherScheduleReferences.ChildNodes; // 8Nodes
                for (int iReferenceCodedIndex = 0; iReferenceCodedIndex < xnReferenceCoded.Count; iReferenceCodedIndex++)
                {
                    XmlNodeList xnReferences = xnReferenceCoded[iReferenceCodedIndex].ChildNodes;
                    if (xnReferences.Count == 3 &&
                        ((xnReferences[1].Name.Trim().Equals(string.Format("core:{0}", MeridianGlobalConstants.XCBL_REFERENCE_TYPECODE_OTHER), StringComparison.OrdinalIgnoreCase) &&
                          xnReferences[2].Name.Trim().Equals(string.Format("core:{0}", MeridianGlobalConstants.XCBL_REFERENCE_DESCRIPTION), StringComparison.OrdinalIgnoreCase)) ||
                         (xnReferences[1].Name.Trim().Equals(MeridianGlobalConstants.XCBL_REFERENCE_TYPECODE_OTHER, StringComparison.OrdinalIgnoreCase) &&
                          xnReferences[2].Name.Trim().Equals(MeridianGlobalConstants.XCBL_REFERENCE_DESCRIPTION, StringComparison.OrdinalIgnoreCase))))
                    {
                        processData.ShippingScheduleResponse.SetOtherScheduleReferenceDesc(xnReferences[1].InnerText, xnReferences[2].InnerText.ReplaceSpecialCharsWithSpace());
                    }
                }
            }
        }
示例#12
0
        /// <summary>
        /// To get seller order number and sequence
        /// </summary>
        /// <param name="xmlNsManager"> XmlNamespaceManager </param>
        /// <param name="xnScheduleReferences">ScheduleReferences xml node from requested data </param>
        /// <param name="processData">Process data</param>
        private void GetPurchaseOrderReference(XmlNamespaceManager xmlNsManager, XmlNode xnScheduleReferences, ProcessData processData)
        {
            XmlNode xnPurchaseOrderReferences = xnScheduleReferences.GetNodeByNameAndLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_PURCHASE_ORDER_REFERENCE, "04", processData, processData.ScheduleResponseID, "GetPurchaseOrderReference");

            if (xnPurchaseOrderReferences != null)
            {
                XmlNodeList xnlPurchaseOrderReferences = xnPurchaseOrderReferences.ChildNodes;
                for (int iPurchaseOrderIndex = 0; iPurchaseOrderIndex < xnlPurchaseOrderReferences.Count; iPurchaseOrderIndex++)
                {
                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_SELLER_ORDER_NUMBER))
                    {
                        processData.ShippingScheduleResponse.OrderNumber = xnlPurchaseOrderReferences[iPurchaseOrderIndex].InnerText.ReplaceSpecialCharsWithSpace();
                    }

                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_ORDER_TYPE))
                    {
                        XmlNodeList xnlOrderType = xnlPurchaseOrderReferences[iPurchaseOrderIndex].ChildNodes;
                        for (int iOrderType = 0; iOrderType < xnlOrderType.Count; iOrderType++)
                        {
                            if (xnlOrderType[iOrderType].Name.Contains(MeridianGlobalConstants.XCBL_ORDER_TYPE_CODED_OTHER))
                            {
                                processData.ShippingScheduleResponse.OrderType = xnlOrderType[iOrderType].InnerText.ReplaceSpecialCharsWithSpace();
                            }
                        }
                    }

                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_CHANGE_ORDER_SEQUENCE_NUMBER))
                    {
                        processData.ShippingScheduleResponse.SequenceNumber = xnlPurchaseOrderReferences[iPurchaseOrderIndex].InnerText.ReplaceSpecialCharsWithSpace();
                    }
                }
            }
        }
示例#13
0
 public static XmlNode GetNodeByNameAndLogErrorTrans(this XmlNode fromNode, XmlNamespaceManager nsMgr, string nodeName, string errorNumber, ProcessData processData, string uniqueId, string methodName = "")
 {
     try
     {
         XmlNode foundNode = fromNode.SelectSingleNode(nodeName, nsMgr);//
         //if (foundNode == null || string.IsNullOrEmpty(foundNode.InnerText))
         //   LogTransaction(processData.WebUserName, processData.FtpUserName, !string.IsNullOrEmpty(methodName) ? methodName : "ValidateScheduleShippingXmlDocument", string.Format("03.{0}", errorNumber), string.Format("Error - There was an exception retrieving {0} xml node or tag or empty.", nodeName), string.Format("Error - There was an exception retrieving {0} xml node or tag or empty.", nodeName), processData.CsvFileName, uniqueId, processData.OrderNumber, processData.XmlDocument, string.Format("Error 03.{0} - Issue with node {1}", errorNumber, nodeName));
         return(foundNode);
     }
     catch (Exception e)
     {
         //LogTransaction(processData.WebUserName, processData.FtpUserName, !string.IsNullOrEmpty(methodName) ? methodName : "ValidateScheduleShippingXmlDocument", string.Format("03.{0}", errorNumber), string.Format("Error - There was an exception retrieving {0} xml node or tag or empty.", nodeName), Convert.ToString(e.Message), processData.CsvFileName, uniqueId, processData.OrderNumber, processData.XmlDocument, string.Format("Error 03.{0} - Issue with node {1}", errorNumber, nodeName));
         return(null);
     }
 }
        private bool UpdateToServer(ProcessData processData)
        {
            bool result = false;

            try
            {
                if (processData != null && !string.IsNullOrEmpty(processData.ScheduleID) &&
                    !string.IsNullOrEmpty(processData.OrderNumber) &&
                    !string.IsNullOrEmpty(processData.CsvFileName))
                {
                    var initialResponse = (processData.ShippingSchedule.Approve01.Equals(MeridianGlobalConstants.XCBL_YES_FLAG) ||
                                           processData.ShippingSchedule.Approve02.Equals(MeridianGlobalConstants.XCBL_YES_FLAG) ||
                                           processData.ShippingSchedule.Approve03.Equals(MeridianGlobalConstants.XCBL_YES_FLAG) ||
                                           processData.ShippingSchedule.Approve04.Equals(MeridianGlobalConstants.XCBL_YES_FLAG) ||
                                           processData.ShippingSchedule.Approve05.Equals(MeridianGlobalConstants.XCBL_YES_FLAG)) ?
                                          MeridianGlobalConstants.XCBL_SHIPPING_SCHEDULE_REQUEST_ACCEPTED_FOR_CSV :
                                          processData.ShippingSchedule.Rejected01.Equals(MeridianGlobalConstants.XCBL_YES_FLAG) ?
                                          MeridianGlobalConstants.XCBL_SHIPPING_SCHEDULE_REQUEST_REJECTED_FOR_CSV :
                                          MeridianGlobalConstants.XCBL_SHIPPING_SCHEDULE_REQUEST_PENDING_FOR_CSV;

                    var record = string.Format(MeridianGlobalConstants.CSV_HEADER_NAMES_FORMAT,
                                               processData.ShippingSchedule.ScheduleID, processData.ShippingSchedule.ScheduleIssuedDate, processData.ShippingSchedule.OrderNumber, processData.ShippingSchedule.SequenceNumber,
                                               processData.ShippingSchedule.Other_FirstStop, processData.ShippingSchedule.Other_Before7, processData.ShippingSchedule.Other_Before9, processData.ShippingSchedule.Other_Before12, processData.ShippingSchedule.Other_SameDay, processData.ShippingSchedule.Other_OwnerOccupied, processData.ShippingSchedule.Other_7, processData.ShippingSchedule.Other_8, processData.ShippingSchedule.Other_9, processData.ShippingSchedule.Other_10,
                                               processData.ShippingSchedule.PurposeCoded, processData.ShippingSchedule.ScheduleType, processData.ShippingSchedule.AgencyCoded, processData.ShippingSchedule.Name1, processData.ShippingSchedule.Street, processData.ShippingSchedule.StreetSupplement1, processData.ShippingSchedule.PostalCode, processData.ShippingSchedule.City, processData.ShippingSchedule.RegionCoded,
                                               processData.ShippingSchedule.ContactName, processData.ShippingSchedule.ContactNumber_1, processData.ShippingSchedule.ContactNumber_2, processData.ShippingSchedule.ContactNumber_3, processData.ShippingSchedule.ContactNumber_4, processData.ShippingSchedule.ContactNumber_5, processData.ShippingSchedule.ContactNumber_6,
                                               processData.ShippingSchedule.ShippingInstruction, processData.ShippingSchedule.GPSSystem, processData.ShippingSchedule.Latitude.ToString(), processData.ShippingSchedule.Longitude.ToString(), processData.ShippingSchedule.LocationID, processData.ShippingSchedule.EstimatedArrivalDate, processData.ShippingSchedule.OrderType, initialResponse);
                    // StringBuilder strBuilder = new StringBuilder(MeridianGlobalConstants.CSV_HEADER_NAMES);
                    // strBuilder.AppendLine();
                    // strBuilder.AppendLine(record);
                    // string csvContent = strBuilder.ToString();

                    DataSet ds = MeridianSystemLibrary.GetDataByRef(processData.ShippingSchedule.OrderNumber);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["CANCELLED"].ToString() == "1")
                        {
                            ApplicationError.WriteMessage("Ref Number Order Canceled : " + processData.ShippingSchedule.OrderNumber.Replace(" ", "") + " Order Canceled Failure Notify.  ");
                            return(result = false);
                        }
                        if (ds.Tables[0].Rows[0]["DROPDATE"] != DBNull.Value && ds.Tables[0].Rows[0]["DROPPEDOFF"].ToString() == "1")
                        {
                            ApplicationError.WriteMessage("Ref Number :" + processData.ShippingSchedule.OrderNumber.Replace(" ", "") + " All Ready Deliverd Failure Notify.   ");
                            return(result = false);
                        }
                    }
                    else
                    {
                        ApplicationError.WriteMessage("Ref Number Not Found : " + processData.ShippingSchedule.OrderNumber.Replace(" ", ""));
                        return(result = false);
                    }

                    int exeresult = MeridianSystemLibrary.UpdateDataToLocal(processData);
                    if (exeresult > 0)
                    {
                        ApplicationError.WriteMessage("Success Process Ref Number : " + processData.ShippingSchedule.OrderNumber);
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                ApplicationError.logErrors(ex, "UpdateToServer");
            }

            return(result);
        }
        private bool UsePBSServiceDataAndUpdateFlags(ProcessData processData)
        {
            bool result = false;

            try
            {
                string destinationName               = null;
                string orderNumber                   = null;
                string destinationStreet             = null;
                string destinationStreetSupplement1  = null;
                string destinationPostalCode         = null;
                string destinationCity               = null;
                string destinationRegionCoded        = null;
                string scheduledShipmentDateInString = null;
                string scheduledDeliveryDateInString = null;
                string isScheduled                   = null;

                /* Expecting data to come in below sequence and updating the fields based on this only
                 *
                 * JobNo,Delivery Date,ShpDate,Scheduled,Order Date,Job Order,Job Category,Job Type,Customer,
                 * Company Name,Contract Number,Order Number,Origin Location,Origin Name,Origin Address,Origin Address2,
                 * Origin City,Origin State,Origin Zip,Origin Attention,Origin Phone,Origin Phone2,Origin Fax,
                 * Origin Email,Destination Location,Destination Name,Destination Address,Destination Address2,
                 * Destination City,Destination State,Destination Zip,Destination Attention,Destination Phone,
                 * Destination Phone2,Destination Email,Destination Note,Service Type,Mode,Partner Name,Driver Number,
                 * Driver,ApprDel,ShprNo
                 *
                 */

                var pbsQueryResult      = ProcessPBSQueryResult.Instance;
                var currentOrderDetails = new PBSData();
                if (pbsQueryResult.AllPBSOrder.ContainsKey(processData.OrderNumber.Trim()))
                {
                    currentOrderDetails = pbsQueryResult.AllPBSOrder[processData.OrderNumber.Trim()];
                }
                destinationName               = currentOrderDetails.DestinationName;
                orderNumber                   = currentOrderDetails.OrderNumber;
                destinationStreet             = currentOrderDetails.DestinationStreet;
                destinationStreetSupplement1  = currentOrderDetails.DestinationStreetSupplyment1;
                destinationPostalCode         = currentOrderDetails.DestinationPostalCode;
                destinationCity               = currentOrderDetails.DestinationCity;
                destinationRegionCoded        = currentOrderDetails.DestinationRegionCoded;
                scheduledShipmentDateInString = currentOrderDetails.ShipmentDate;
                scheduledDeliveryDateInString = currentOrderDetails.DeliveryDate;
                isScheduled                   = currentOrderDetails.IsScheduled;

                if (!string.IsNullOrWhiteSpace(scheduledShipmentDateInString) && !string.IsNullOrWhiteSpace(orderNumber) && (processData.ShippingSchedule.OrderNumber.Trim().Equals(orderNumber.Trim(), StringComparison.OrdinalIgnoreCase)))
                {
                    #region XCBL Data

                    var      xcblRequestDate           = DateTimeOffset.Parse(processData.ShippingSchedule.ScheduleIssuedDate).UtcDateTime;
                    var      xcblScheduledShipDate     = DateTimeOffset.Parse(processData.ShippingSchedule.ScheduleIssuedDate).UtcDateTime;
                    DateTime?xcblScheduledDeliveryDate = null;
                    if (!string.IsNullOrWhiteSpace(processData.ShippingSchedule.EstimatedArrivalDate))
                    {
                        xcblScheduledDeliveryDate = DateTimeOffset.Parse(processData.ShippingSchedule.EstimatedArrivalDate).UtcDateTime;
                    }

                    var xcblDeliveryName      = processData.ShippingSchedule.Name1 ?? "";
                    var xcblStreet            = processData.ShippingSchedule.Street ?? "";
                    var xcblStreetSupplement1 = processData.ShippingSchedule.StreetSupplement1 ?? "";
                    var xcblPostalCode        = processData.ShippingSchedule.PostalCode ?? "";
                    var xcblCity        = processData.ShippingSchedule.City ?? "";
                    var xcblRegionCoded = processData.ShippingSchedule.RegionCoded ?? "";

                    var xcblSameDay       = processData.ShippingSchedule.Other_SameDay ?? "";
                    var xcblFirstStop     = processData.ShippingSchedule.Other_FirstStop ?? "";
                    var xcblBefore7       = processData.ShippingSchedule.Other_Before7 ?? "";
                    var xcblBefore9       = processData.ShippingSchedule.Other_Before9 ?? "";
                    var xcblBefore12      = processData.ShippingSchedule.Other_Before12 ?? "";
                    var xcblOwnerOccupied = processData.ShippingSchedule.Other_OwnerOccupied ?? "";

                    #endregion  XCBL Data

                    #region PBS Data

                    destinationName              = destinationName ?? "";
                    destinationStreet            = destinationStreet ?? "";
                    destinationStreetSupplement1 = destinationStreetSupplement1 ?? "";
                    destinationCity              = destinationCity ?? "";
                    destinationPostalCode        = processData.ShippingSchedule.PostalCode ?? "";
                    destinationRegionCoded       = destinationRegionCoded ?? "";
                    isScheduled = isScheduled ?? "";

                    var scheduledShipmentDate     = DateTimeOffset.Parse(scheduledShipmentDateInString).UtcDateTime;
                    var scheduledShipmentDate10AM = new DateTime(scheduledShipmentDate.Year, scheduledShipmentDate.Month, scheduledShipmentDate.Day, 10, 0, 0);

                    DateTime?scheduledDeliveryDate     = null;
                    DateTime?scheduledDeliveryDate10AM = null;
                    if (!string.IsNullOrWhiteSpace(scheduledDeliveryDateInString))
                    {
                        scheduledDeliveryDate = DateTimeOffset.Parse(scheduledDeliveryDateInString).UtcDateTime;
                    }
                    if (!string.IsNullOrWhiteSpace(scheduledDeliveryDateInString))
                    {
                        scheduledDeliveryDate10AM = new DateTime(scheduledDeliveryDate.Value.Year, scheduledDeliveryDate.Value.Month, scheduledDeliveryDate.Value.Day, 10, 0, 0);
                    }

                    #endregion PBS Data

                    var currentDateTime = DateTime.UtcNow;

                    if (isScheduled.Trim().Equals(MeridianGlobalConstants.PBS_SCHEDULED_FALSE, StringComparison.OrdinalIgnoreCase))
                    {
                        processData.ShippingSchedule.Approve05 = _meridianResult.Approve05 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((scheduledShipmentDate >= currentDateTime) && (xcblRequestDate > scheduledShipmentDate10AM.AddDays(-2)))
                    {
                        processData.ShippingSchedule.Pending01 = _meridianResult.Pending01 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((scheduledShipmentDate < currentDateTime) && scheduledDeliveryDate10AM.HasValue && (xcblRequestDate > scheduledDeliveryDate10AM.Value.AddDays(-2)))
                    {
                        processData.ShippingSchedule.Pending02 = _meridianResult.Pending02 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if (xcblSameDay.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase) ||
                             xcblFirstStop.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase) ||
                             xcblBefore7.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase) ||
                             xcblBefore9.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase) ||
                             xcblBefore12.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase) ||
                             xcblOwnerOccupied.Equals(MeridianGlobalConstants.XCBL_YES_FLAG, StringComparison.OrdinalIgnoreCase))
                    {
                        processData.ShippingSchedule.Pending03 = _meridianResult.Pending03 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if (!xcblStreet.Trim().Equals(destinationStreet.Trim(), StringComparison.OrdinalIgnoreCase) ||
                             !xcblStreetSupplement1.Trim().Equals(destinationStreetSupplement1.Trim(), StringComparison.OrdinalIgnoreCase) ||
                             !xcblPostalCode.Trim().Equals(destinationPostalCode.Trim(), StringComparison.OrdinalIgnoreCase) ||
                             !xcblCity.Trim().Equals(destinationCity.Trim(), StringComparison.OrdinalIgnoreCase) ||
                             !xcblRegionCoded.Trim().Equals(destinationRegionCoded.Trim(), StringComparison.OrdinalIgnoreCase))
                    {
                        processData.ShippingSchedule.Pending04 = _meridianResult.Pending04 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((processData.ShippingSchedule.OrderType != null) &&
                             (processData.ShippingSchedule.OrderType.Trim().Equals(MeridianGlobalConstants.XCBL_ORDER_TYPE_NPT, StringComparison.OrdinalIgnoreCase) ||
                              processData.ShippingSchedule.OrderType.Trim().Equals(MeridianGlobalConstants.XCBL_ORDER_TYPE_RRO, StringComparison.OrdinalIgnoreCase)))
                    {
                        processData.ShippingSchedule.Approve01 = _meridianResult.Approve01 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((scheduledShipmentDate > currentDateTime) && (xcblRequestDate <= scheduledShipmentDate10AM.AddDays(-2)))
                    {
                        processData.ShippingSchedule.Approve02 = _meridianResult.Approve02 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((scheduledShipmentDate < currentDateTime) && scheduledDeliveryDate10AM.HasValue && (xcblRequestDate <= scheduledDeliveryDate10AM.Value.AddDays(-2)))
                    {
                        processData.ShippingSchedule.Approve03 = _meridianResult.Approve03 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else if ((xcblScheduledShipDate == scheduledShipmentDate) &&
                             xcblScheduledDeliveryDate.HasValue && scheduledDeliveryDate.HasValue &&
                             (xcblScheduledDeliveryDate.Value == scheduledDeliveryDate.Value) &&
                             xcblSameDay.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase) &&
                             xcblFirstStop.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase) &&
                             xcblBefore7.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase) &&
                             xcblBefore9.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase) &&
                             xcblBefore12.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase) &&
                             xcblOwnerOccupied.Equals(MeridianGlobalConstants.XCBL_NO_FLAG, StringComparison.OrdinalIgnoreCase))
                    {
                        processData.ShippingSchedule.Approve04 = _meridianResult.Approve04 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                    else
                    {
                        processData.ShippingSchedule.Pending05 = _meridianResult.Pending05 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    }
                }
                else
                {
                    processData.ShippingSchedule.Rejected01 = _meridianResult.Rejected01 = MeridianGlobalConstants.XCBL_YES_FLAG;
                    processData.ShippingSchedule.Comments   = _meridianResult.Comments = MeridianGlobalConstants.XCBL_COMMENT_ORDER_NOT_FOUND;
                    // MeridianSystemLibrary.LogTransaction(processData.WebUserName, processData.FtpUserName, "UsePBSServiceDataAndUpdateFlags", "02.24", "Warning - No Data from PBS WebService", string.Format("Warning - No data got for Order '{0}' from PBS WebService", processData.OrderNumber), processData.CsvFileName, processData.ScheduleID, processData.OrderNumber, null, "Warning 02.24");
                }

                result = true;
                MeridianSystemLibrary.LogPBS(
                    processData.ScheduleID, processData.OrderNumber,
                    processData.ShippingSchedule.Approve01, processData.ShippingSchedule.Approve02,
                    processData.ShippingSchedule.Approve03, processData.ShippingSchedule.Approve04,
                    processData.ShippingSchedule.Approve05, processData.ShippingSchedule.Pending01,
                    processData.ShippingSchedule.Pending02, processData.ShippingSchedule.Pending03,
                    processData.ShippingSchedule.Pending04, processData.ShippingSchedule.Pending05,
                    "ShippingSchedule", processData.ShippingSchedule.Rejected01, processData.ShippingSchedule.Comments);
            }
            catch (Exception ex)
            {
                ApplicationError.logErrors(ex);
                ApplicationError.logErrors(ex, "UsePBSServiceDataAndUpdateFlags");
            }

            return(result);
        }
        private void GetPurchaseOrderReference(XmlNamespaceManager xmlNsManager, XmlNode xnScheduleReferences, ProcessData processData)
        {
            XmlNode xnPurchaseOrderReferences = xnScheduleReferences.GetNodeByNameAndLogWarningTrans(xmlNsManager, MeridianGlobalConstants.XCBL_PURCHASE_ORDER_REFERENCE, "04", processData, processData.ScheduleID, "GetPurchaseOrderReference");

            if (xnPurchaseOrderReferences != null)
            {
                XmlNodeList xnlPurchaseOrderReferences = xnPurchaseOrderReferences.ChildNodes;
                for (int iPurchaseOrderIndex = 0; iPurchaseOrderIndex < xnlPurchaseOrderReferences.Count; iPurchaseOrderIndex++)
                {
                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_SELLER_ORDER_NUMBER))
                    {
                        processData.OrderNumber = xnlPurchaseOrderReferences[iPurchaseOrderIndex].InnerText.ReplaceSpecialCharsWithSpace();
                        processData.ShippingSchedule.OrderNumber = processData.OrderNumber;

                        string formattedOrderNumber = processData.OrderNumber.ReplaceSpecialCharsWithSpace().Replace(" ", "");
                        string fileNameFormat       = DateTime.Now.ToString(MeridianGlobalConstants.XCBL_FILE_DATETIME_FORMAT);
                        processData.CsvFileName = string.Concat(MeridianGlobalConstants.XCBL_AWC_FILE_PREFIX, fileNameFormat, formattedOrderNumber, MeridianGlobalConstants.XCBL_FILE_EXTENSION);
                        processData.XmlFileName = string.Concat(MeridianGlobalConstants.XCBL_AWC_FILE_PREFIX, fileNameFormat, formattedOrderNumber, MeridianGlobalConstants.XCBL_XML_EXTENSION);
                    }

                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_ORDER_TYPE))
                    {
                        XmlNodeList xnlOrderType = xnlPurchaseOrderReferences[iPurchaseOrderIndex].ChildNodes;
                        for (int iOrderType = 0; iOrderType < xnlOrderType.Count; iOrderType++)
                        {
                            if (xnlOrderType[iOrderType].Name.Contains(MeridianGlobalConstants.XCBL_ORDER_TYPE_CODED_OTHER))
                            {
                                processData.ShippingSchedule.OrderType = xnlOrderType[iOrderType].InnerText.ReplaceSpecialCharsWithSpace();
                            }
                        }
                    }

                    if (xnlPurchaseOrderReferences[iPurchaseOrderIndex].Name.Contains(MeridianGlobalConstants.XCBL_CHANGE_ORDER_SEQUENCE_NUMBER))
                    {
                        processData.ShippingSchedule.SequenceNumber = xnlPurchaseOrderReferences[iPurchaseOrderIndex].InnerText.ReplaceSpecialCharsWithSpace();
                    }
                }
            }
        }