public StreetNameDetailQuery(
     LegacyContext legacyContext,
     SyndicationContext syndicationContext,
     IOptions <ResponseOptions> responseOptionsProvider)
 {
     _legacyContext      = legacyContext;
     _syndicationContext = syndicationContext;
     _responseOptions    = responseOptionsProvider.Value;
 }
示例#2
0
文件: Message.cs 项目: tdav/OnPool
 public static Message BuildServerResponse(string method, ResponseOptions options = ResponseOptions.SingleResponse)
 {
     return(new Message()
     {
         Method = method,
         Direction = MessageDirection.Response,
         Type = MessageType.Client,
         ResponseOptions = options
     });
 }
        /// <param name="transform">Should be a Func<T, TTransform></param>
        public static DataTablesResult Create(IQueryable queryable, DataTablesParam dataTableParam, object transform,
                                              ResponseOptions responseOptions = null)
        {
            var s = "Create";
            var openCreateMethod   = typeof(DataTablesResult).GetMethods().Single(x => x.Name == s && x.GetGenericArguments().Count() == 1);
            var queryableType      = queryable.GetType().GetGenericArguments()[0];
            var closedCreateMethod = openCreateMethod.MakeGenericMethod(queryableType, typeof(object));

            return((DataTablesResult)closedCreateMethod.Invoke(null, new object[] { queryable, dataTableParam, transform, responseOptions }));
        }
        public void LoadJsonFiles(string targetPath, ResponseOptions saveFile = ResponseOptions.Yes)
        {
            Courier courier = new Courier(saveFile, "JE_RUN_SAVE_FILES_CHECK");
            Bard    bard    = new Bard("SelectedPath", targetPath);

            bard.InputInformation.Add("DialogResult", ResponseOptions.OK);
            AdventurerAssociation.RegisterMember(bard);
            AdventurerAssociation.RegisterMember(courier);
            MainFormInvoke(MainForm.tmiLoadJsonFiles_Click);
        }
        public void NewJsonFiles(string targetPath, ResponseOptions deleteFile = ResponseOptions.Yes)
        {
            Courier courier = new Courier(deleteFile, "JE_RUN_NEW_JSON_FILES_Q_1");
            Bard    bard    = new Bard("SelectedPath", targetPath);

            bard.InputInformation.Add("DialogResult", ResponseOptions.OK);
            AdventurerAssociation.RegisterMember(bard);
            AdventurerAssociation.RegisterMember(courier);
            MainFormInvoke(MainForm.tmiNewJsonFiles_Click);
        }
示例#6
0
 public ConsistencyMiddleware(
     RequestDelegate next,
     ResponseOptions options,
     ILogger <ConsistencyMiddleware> logger,
     ExceptionStatusCodeHandler exceptionStatusCodeHandler)
 {
     _next    = next ?? throw new ArgumentNullException(nameof(next));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _exceptionStatusCodeHandler = exceptionStatusCodeHandler ?? throw new ArgumentNullException(nameof(exceptionStatusCodeHandler));
     _responseHelper             = new ResponseHelper(_options);
 }
 public static AdresMatchItem Create(
     AdresMatchScorableItem scorableItem,
     BuildingContext buildingContext,
     AddressMatchContext addressMatchContext,
     ResponseOptions responseOptions)
 {
     return(new AdresMatchItem
     {
         Identificator = scorableItem.Identificator,
         Detail = scorableItem.Detail,
         Gemeente = scorableItem.Gemeente,
         Straatnaam = scorableItem.Straatnaam,
         AdresStatus = scorableItem.AdresStatus,
         Postinfo = scorableItem.Postinfo,
         HomoniemToevoeging = scorableItem.HomoniemToevoeging,
         Huisnummer = scorableItem.Huisnummer,
         Busnummer = scorableItem.Busnummer,
         PositieGeometrieMethode = scorableItem.PositieGeometrieMethode,
         AdresPositie = scorableItem.AdresPositie,
         PositieSpecificatie = scorableItem.PositieSpecificatie,
         VolledigAdres = scorableItem.VolledigAdres,
         OfficieelToegekend = scorableItem.OfficieelToegekend,
         Score = scorableItem.Score,
         AdresseerbareObjecten = buildingContext.BuildingUnits
                                 .Include(x => x.Addresses)
                                 .Where(x => x.Addresses.Any(y => y.AddressId == scorableItem.AddressId) && !x.IsRemoved && x.IsBuildingComplete && x.IsComplete && x.PersistentLocalId.HasValue)
                                 .Select(x => new { x.PersistentLocalId })
                                 .ToList()
                                 .Select(matchLatestItem => new AdresseerbaarObject
         {
             ObjectId = matchLatestItem.PersistentLocalId.ToString(),
             ObjectType = ObjectType.Gebouweenheid,
             Detail = string.Format(responseOptions.GebouweenheidDetailUrl, matchLatestItem.PersistentLocalId.ToString()),
         })
                                 .ToList()
                                 .Concat(
             addressMatchContext.ParcelAddressMatchLatestItems
             .Where(x => x.AddressId == scorableItem.AddressId && !x.IsRemoved)
             .ToList()
             .Select(matchLatestItem => new AdresseerbaarObject
         {
             ObjectId = matchLatestItem.ParcelPersistentLocalId,
             ObjectType = ObjectType.Perceel,
             Detail = string.Format(responseOptions.PerceelDetailUrl, matchLatestItem.ParcelPersistentLocalId),
         })
             .ToList())
                                 .ToList()
     });
 }
示例#8
0
    /// <summary>
    /// Actually calls into Compare Service to perform comparison. Currently it used a hardcoded
    /// binding wsHttpBinding. After the call has returned successfully, it calls the results
    /// routine to display the results.
    /// </summary>
    /// <param name="sOriginalFile"></param>
    /// <param name="sModifiedFile"></param>
    /// <param name="sVirtualPath"></param>
    private void DoCompare(string sOriginalFile, string sModifiedFile, string sVirtualPath)
    {
        ResponseOptions responseOptions = ResponseOptions.Rtf;

        string password = (string)Session["Passw"];

        password = CodePassword(password);

        // Hardcoded wsHttpBinding. Host info is picked from config file
        ComparerClient cp = new ComparerClient("CompareWebServiceWCF");

        cp.ClientCredentials.Windows.ClientCredential.UserName = UserNameTextBox.Text;
        cp.ClientCredentials.Windows.ClientCredential.Password = password;
        cp.ClientCredentials.Windows.ClientCredential.Domain   = RealmTextBox.Text;

        // Authenticate first.
        if (cp.Authenticate(RealmTextBox.Text, UserNameTextBox.Text, password))
        {
            byte[] original      = File.ReadAllBytes(sOriginalFile);
            byte[] modified      = File.ReadAllBytes(sModifiedFile);
            string sRenderingSet = RenderingSetDropDownList.SelectedValue;
            string sOptionSet    = File.ReadAllText(Request.MapPath(Path.Combine(sRenderSetPath, sRenderingSet)));

            ExecuteParams executeParams = new ExecuteParams()
            {
                CompareOptions       = sOptionSet,
                ResponseOption       = responseOptions,
                Original             = original,
                Modified             = modified,
                OriginalDocumentInfo = new DocumentInfo()
                {
                    DocumentDescription = Path.GetFileName(sOriginalFile), DocumentSource = Path.GetFileName(sOriginalFile)
                },
                ModifiedDocumentInfo = new DocumentInfo()
                {
                    DocumentDescription = Path.GetFileName(sModifiedFile), DocumentSource = Path.GetFileName(sModifiedFile)
                },
            };
            // Peform comparison
            CompareResults results = cp.ExecuteEx(executeParams);

            // Prepare and Display results.
            HandleResults(results, responseOptions, sOriginalFile, sModifiedFile, sRenderingSet, sVirtualPath);
        }
        else
        {
            ShowMessage("Authentication failed.");
        }
    }
示例#9
0
        public void SendAllPoolMessage <T>(string poolName, string method, object payload = null, Action <T> callback = null,
                                           ResponseOptions responseOptions = ResponseOptions.SingleResponse)
        {
            var message = new Message()
            {
                Method          = method,
                Direction       = MessageDirection.Request,
                Type            = MessageType.PoolAll,
                ToPool          = poolName,
                ResponseOptions = responseOptions
            };

            message.AddJson(payload);
            sendMessage(message, callback);
        }
示例#10
0
        public static DataTablesResult <TSource> Create <TSource>(IQueryable <TSource> q, DataTablesParam dataTableParam,
                                                                  ResponseOptions <TSource> responseOptions = null)
        {
            var result = new DataTablesResult <TSource>(q, dataTableParam);

            var dictionaryTransform = DataTablesTypeInfo <TSource> .ToDictionary(responseOptions);

            result.Data = result.Data
                          .Transform <TSource, Dictionary <string, object> >(dictionaryTransform)
                          .Transform <Dictionary <string, object>, Dictionary <string, object> >(StringTransformers.StringifyValues);

            result.Data = ApplyOutputRules(result.Data, responseOptions);

            return(result);
        }
示例#11
0
        public static DataTablesResponse GetDataTableResultNoLock <T>(this IQueryable <T> query, DataTablesModel param)
        {
            var dataTablesResponseData = param.ToDataTablesParam().GetDataTablesResponseNoLock(query);

            dataTablesResponseData.iTotalDisplayRecords = dataTablesResponseData.iTotalRecords;
            var responseOptions = new ResponseOptions <T>()
            {
                ArrayOutputType = null
            };
            var dictionaryTransform = DataTablesTypeInfo <T> .ToDictionary(responseOptions);

            dataTablesResponseData = dataTablesResponseData.Transform <T, Dictionary <string, object> >(dictionaryTransform)
                                     .Transform <Dictionary <string, object>, Dictionary <string, object> >(StringTransformers.StringifyValues);
            dataTablesResponseData = ApplyOutputRules(dataTablesResponseData, responseOptions);
            return(dataTablesResponseData.ToDataTablesResponse());
        }
示例#12
0
        public static async Task <DataTablesResponse> GetDataTableResultAsync <T>(this IQueryable <T> query,
                                                                                  DataTablesModel param, bool disablePaging = false)
        {
            var dataTablesResponseData =
                await param.ToDataTablesParam().GetDataTablesResponseAsync(query, disablePaging).ConfigureAwait(false);

            dataTablesResponseData.iTotalDisplayRecords = dataTablesResponseData.iTotalRecords;
            var responseOptions = new ResponseOptions <T>()
            {
                ArrayOutputType = null
            };
            var dictionaryTransform = DataTablesTypeInfo <T> .ToDictionary(responseOptions);

            dataTablesResponseData = dataTablesResponseData.Transform <T, Dictionary <string, object> >(dictionaryTransform)
                                     .Transform <Dictionary <string, object>, Dictionary <string, object> >(StringTransformers.StringifyValues);
            dataTablesResponseData = ApplyOutputRules(dataTablesResponseData, responseOptions);
            return(dataTablesResponseData.ToDataTablesResponse());
        }
示例#13
0
        /// <summary>
        ///     Return extention string of ComparerArguments object
        /// </summary>
        /// <param name="ro"></param>
        /// <returns></returns>
        private string getExtension(ResponseOptions ro)
        {
            switch (ro)
            {
            case ResponseOptions.Doc:
            case ResponseOptions.DocWithSummary:
            case ResponseOptions.RedlinMlAndDoc:
            case ResponseOptions.RedlinMlAndDocAndSummary:
                return("doc");

            case ResponseOptions.DocX:
            case ResponseOptions.DocXWithSummary:
            case ResponseOptions.RedlinMlAndDocX:
            case ResponseOptions.RedlinMlAndDocXAndSummary:
                return("docx");

            case ResponseOptions.Pdf:
            case ResponseOptions.PdfWithSummary:
            case ResponseOptions.RedlinMlAndPdf:
            case ResponseOptions.RedlinMlAndPdfAndSummary:
                return("pdf");

            case ResponseOptions.Rtf:
            case ResponseOptions.RtfWithSummary:
            case ResponseOptions.RedlinMlAndRtf:
            case ResponseOptions.RedlinMlAndRtfAndSummary:
                return("rtf");

            case ResponseOptions.Wdf:
            case ResponseOptions.WdfWithSummary:
                return("wdf");

            case ResponseOptions.RedlinMl:
            case ResponseOptions.RedlinMlAndSummary:
                return("rmi");

            case ResponseOptions.Xml:
                return("xml");

            default:
                return("doc");
            }
        }
示例#14
0
        public static async Task <DataTablesResponseData> GetDataTableResponseAsync <TSource>(this IQueryable <TSource> data, DataTablesParam param, Action <TSource> postQueryTransform, bool disablePaging = false)
        {
            var filters          = new DataTablesFiltering();
            var outputProperties = DataTablesTypeInfo <TSource> .Properties;

            List <TSource> queryResult;
            var            totalDisplayRecords = 0;
            var            filteredData        = filters.ApplyFiltersAndSort(param, data, outputProperties);

            if (!disablePaging)
            {
                totalDisplayRecords = await filteredData.CountAsync();

                var skipped = filteredData.Skip(param.iDisplayStart);
                queryResult = await(param.iDisplayLength <= 0 ? skipped : skipped.Take(param.iDisplayLength)).ToListAsync();
            }
            else
            {
                queryResult = await filteredData.ToListAsync();

                totalDisplayRecords = queryResult.Count();
            }

            queryResult.ForEach(postQueryTransform);

            var result = new DataTablesResponseData()
            {
                iTotalRecords        = totalDisplayRecords,
                iTotalDisplayRecords = totalDisplayRecords,
                sEcho  = param.sEcho,
                aaData = queryResult.Cast <object>().ToArray(),
            };

            var responseOptions = new ResponseOptions <TSource> {
                ArrayOutputType = null
            };
            var dictionaryTransform = DataTablesTypeInfo <TSource> .ToDictionary(responseOptions);

            result = result.Transform(dictionaryTransform).Transform <Dictionary <string, object>, Dictionary <string, object> >(StringTransformers.StringifyValues);
            result = ApplyOutputRules(result, responseOptions);
            return(result);
        }
示例#15
0
        // -------- Constructor --------

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="lineRegex">
        /// The regex to search for to fire the action.
        /// For example, if you want !bot help to trigger the action, pass in "!bot\s+help"
        /// </param>
        /// <param name="lineAction">The action to perform based on the line.</param>
        /// <param name="coolDown">How long to wait between firing the line action in seconds.  0 for no cooldown.</param>
        /// <param name="responseOption">Whether or not to respond to PMs, only channels, or both.</param>
        /// <param name="respondToSelf">Whether or not the bot should respond to lines sent out by itself. Defaulted to false.</param>
        public MessageHandler(
            string lineRegex,
            Action <IIrcWriter, IrcResponse> lineAction,
            int coolDown = 0,
            ResponseOptions responseOption = ResponseOptions.RespondToBoth,
            bool respondToSelf             = false
            )
        {
            ArgumentChecker.StringIsNotNullOrEmpty(lineRegex, nameof(lineRegex));
            ArgumentChecker.IsNotNull(lineAction, nameof(lineAction));
            if (coolDown < 0)
            {
                throw new ArgumentException("cool down must be greater than zero", nameof(coolDown));
            }

            this.LineRegex      = lineRegex;
            this.LineAction     = lineAction;
            this.CoolDown       = coolDown;
            this.RespondToSelf  = respondToSelf;
            this.ResponseOption = responseOption;
            this.LastEvent      = DateTime.MinValue;
            this.KeepHandling   = true;
        }
示例#16
0
        private static DataTablesResponseData ApplyOutputRules <TSource>(DataTablesResponseData sourceData,
                                                                         ResponseOptions <TSource> responseOptions)
        {
            responseOptions = responseOptions ??
                              new ResponseOptions <TSource>()
            {
                ArrayOutputType = ArrayOutputType.BiDimensionalArray
            };
            DataTablesResponseData outputData = sourceData;

            switch (responseOptions.ArrayOutputType)
            {
            case ArrayOutputType.ArrayOfObjects:
                // Nothing is needed
                break;

            case ArrayOutputType.BiDimensionalArray:
            default:
                outputData = sourceData.Transform <Dictionary <string, object>, object[]>(d => d.Values.ToArray());
                break;
            }

            return(outputData);
        }
示例#17
0
        public void SendClientMessage <T>(long clientId, string method, object payload = null, Action <T> callback = null, ResponseOptions responseOptions = ResponseOptions.SingleResponse)
        {
            var message = new Message()
            {
                Method          = method,
                Direction       = MessageDirection.Request,
                Type            = MessageType.Client,
                ToClient        = clientId,
                ResponseOptions = responseOptions
            };

            message.AddJson(payload);
            sendMessage(message, callback);
        }
        protected NegotiatedContentResult <ResponseOptions> OptionsResponse(IList <Link> links)
        {
            ResponseOptions response = new ResponseOptions(Request.RequestUri.PathAndQuery, links);

            return(Content(HttpStatusCode.OK, response));
        }
示例#19
0
    /// <summary>
    /// Prepare and stores the result objects for use by HandleFinalResults, based on output format
    /// selected by user, e.g. .rtf or .wdf etc.
    /// </summary>
    /// <param name="results"></param>
    /// <param name="responseOptions"></param>
    /// <param name="sOriginalFilePath"></param>
    /// <param name="sModifiedFilePath"></param>
    /// <param name="sRenderingSet"></param>
    /// <param name="sVirtualPath"></param>
    private void HandleResults(CompareResults results, ResponseOptions responseOptions, string sOriginalFilePath, string sModifiedFilePath, string sRenderingSet, string sVirtualPath)
    {
        string sFileName = string.Empty;
        string sOutputFileVirtualPath   = string.Empty;
        string sSummaryFileVirtualPath  = string.Empty;
        string sOriginalFileVirtualPath = string.Empty;
        string sModifiedFileVirtualPath = string.Empty;

        // Prepare the virtual path first.
        sVirtualPath = sVirtualPath.Replace('\\', '/');
        string sBasePath = Request.MapPath(sVirtualPath);

        // Prepare labels for Original File
        sFileName = Path.GetFileName(sOriginalFilePath);
        sOriginalFileVirtualPath = sVirtualPath.Replace('\\', '/');
        sOriginalFileVirtualPath = Path.Combine(sOriginalFileVirtualPath, sFileName);

        sOriginalFilePath          = Encode(sOriginalFilePath);
        OriginalFilePathLabel.Text = "<a href='" + Encode(sOriginalFileVirtualPath) + "' target='_blank'>" + sFileName + "</a>";
        RenederingSetLabel.Text    = sRenderingSet;

        // Prepare paths/labels for Output file
        if (responseOptions == ResponseOptions.Rtf)
        {
            if (results.Redline != null)
            {
                sFileName = "redline.rtf";
                sOutputFileVirtualPath = Path.Combine(sVirtualPath, sFileName);

                File.WriteAllBytes(Request.MapPath(sOutputFileVirtualPath), results.Redline);
            }
        }

        if (responseOptions == ResponseOptions.Xml ||
            responseOptions == ResponseOptions.RtfWithSummary ||
            responseOptions == ResponseOptions.WdfWithSummary)
        {
            if (results.Summary != null)
            {
                sFileName = "redline.xml";
                sSummaryFileVirtualPath = Path.Combine(sVirtualPath, sFileName);

                File.WriteAllText(Request.MapPath(sSummaryFileVirtualPath), results.Summary);
            }
        }

        // Prepare path/labels for Modified file
        if (sModifiedFilePath != string.Empty)
        {
            sFileName = Path.GetFileName(sModifiedFilePath);
            sModifiedFileVirtualPath = Path.Combine(sVirtualPath, sFileName);
            sModifiedFileVirtualPath = Encode(sModifiedFileVirtualPath);
        }

        if (sOutputFileVirtualPath != string.Empty)
        {
            sOutputFileVirtualPath = Encode(sOutputFileVirtualPath);
        }

        if (sSummaryFileVirtualPath != string.Empty)
        {
            sSummaryFileVirtualPath = Encode(sSummaryFileVirtualPath);
        }


        // Prepare and show the results table
        UpdateResultsTable(sModifiedFileVirtualPath, sOutputFileVirtualPath, sSummaryFileVirtualPath);
    }
示例#20
0
 public StreetNameMapper(ResponseOptions responseOptions, ILatestQueries latestQueries)
 {
     _responseOptions = responseOptions;
     _latestQueries = latestQueries;
 }
示例#21
0
        public static LabelRequest ConstructLabelRequest(ILabelRequestRequest request)
        {
            DateTime     shipDateTime;
            LabelRequest labelRequest = new LabelRequest()
            {
                Test            = ToolsClass.ParseBoolYESNO(request.PrintSandbox),
                LabelType       = Parsers.ParseLabelType(request.LabelType),
                LabelSize       = Parsers.ParseLabelSize(request.LabelSize, request.LabelType),
                ImageFormat     = ConfigManager.Current.DefaultImageFormat,
                ImageResolution = "300",
                ImageRotation   = "None",
                RequesterID     = ToolsClass.GetRequesterID,
                AccountID       = request.AccountID,
                PassPhrase      = request.PassPhrase,
                MailClass       = Parsers.ParseMailClass(request.MailClass),
                DateAdvance     = ConfigManager.Current.DefaultDateAdvance,
                WeightOz        = request.PackageDetails.WeightOz
            };
            Dimensions dimension = new Dimensions()
            {
                Length = request.PackageDetails.Length,
                Width  = request.PackageDetails.Width,
                Height = request.PackageDetails.Height
            };

            labelRequest.MailpieceDimensions   = dimension;
            labelRequest.PackageTypeIndicator  = ConfigManager.Current.DefaultPackageTypeIndicator;
            labelRequest.Machinable            = ConfigManager.Current.DefaultMachinable;
            labelRequest.SignatureWaiver       = ConfigManager.Current.DefaultSignatureWaiver;
            labelRequest.NoWeekendDelivery     = ConfigManager.Current.DefaultNoWeekendDelivery;
            labelRequest.SundayHolidayDelivery = ConfigManager.Current.DefaultSundayHolidayDelivery;
            labelRequest.EntryFacility         = ConfigManager.Current.DefaultEntryFacility;
            labelRequest.POZipCode             = request.PoZipCode;
            bool includePostage = request.IncludePostage;

            labelRequest.IncludePostage    = includePostage.ToString().ToUpper();
            labelRequest.ReplyPostage      = ConfigManager.Current.DefaultReplayPostage;
            labelRequest.ShowReturnAddress = ConfigManager.Current.DefaultShowReturnAddress;
            includePostage = request.ValidateAddress;
            labelRequest.ValidateAddress = includePostage.ToString().ToUpper();
            SpecialServices specialService = new SpecialServices()
            {
                DeliveryConfirmation    = ToolsClass.ParseBoolONOFF(request.DeliveryConfirmation),
                SignatureConfirmation   = ToolsClass.ParseBoolONOFF(request.SignatureConfirmation),
                CertifiedMail           = ConfigManager.Current.DefaultCertifiedMail,
                RestrictedDelivery      = ConfigManager.Current.DefaultRestrictedDelivery,
                ReturnReceipt           = ConfigManager.Current.DefaultReturnReceipt,
                ElectronicReturnReceipt = ConfigManager.Current.DefaultElectornicReturnReceipt,
                HoldForPickup           = ConfigManager.Current.DefaultHoldForPickup,
                OpenAndDistribute       = ConfigManager.Current.DefaultOpenAndDistribute,
                COD            = ConfigManager.Current.DefaultCOD,
                InsuredMail    = Parsers.ParseInsuredMail(request.InsuredMail),
                AdultSignature = ConfigManager.Current.DefaultAdultSignature,
                AdultSignatureRestrictedDelivery = ConfigManager.Current.DefaultAdultSignatureRestrictedDelivery
            };

            labelRequest.Services             = specialService;
            labelRequest.InsuredValue         = request.OrderValueForInsurance;
            labelRequest.Value                = (float)Convert.ToDouble(request.OrderValueForInsurance);
            labelRequest.CostCenter           = 123;
            labelRequest.PartnerCustomerID    = request.AccountID;
            labelRequest.PartnerTransactionID = request.TransactionId.ToString();
            labelRequest.ReferenceID          = request.OrderId.ToString();
            labelRequest.RubberStamp1         = request.RubberStamp;
            ResponseOptions responseOption = new ResponseOptions()
            {
                PostagePrice = ConfigManager.Current.DefaultResponseOptions
            };

            labelRequest.ResponseOptions = responseOption;
            labelRequest.FromName        = request.SenderDetails.Name;
            labelRequest.FromCompany     = request.SenderDetails.Company;
            labelRequest.ReturnAddress1  = request.SenderDetails.Address1;
            labelRequest.ReturnAddress2  = request.SenderDetails.Address2;
            labelRequest.FromCity        = request.SenderDetails.City;
            labelRequest.FromState       = request.SenderDetails.State;
            labelRequest.FromPostalCode  = request.SenderDetails.PostalCode;
            labelRequest.FromCountry     = request.SenderDetails.Country;
            labelRequest.FromPhone       = request.SenderDetails.Phone;
            labelRequest.FromEMail       = request.SenderDetails.Email;
            labelRequest.ToName          = request.TargetAddress.Name;
            labelRequest.ToCompany       = request.TargetAddress.Company;
            labelRequest.ToAddress1      = request.TargetAddress.Address1;
            labelRequest.ToAddress2      = request.TargetAddress.Address2;
            labelRequest.ToCity          = request.TargetAddress.City;
            labelRequest.ToState         = request.TargetAddress.State;
            labelRequest.ToPostalCode    = request.TargetAddress.PostalCode;
            labelRequest.ToCountry       = request.TargetAddress.Country;
            labelRequest.ToCountryCode   = request.TargetAddress.CountryCode;
            labelRequest.ToPhone         = request.TargetAddress.Phone;
            labelRequest.ToEMail         = request.TargetAddress.Email;

            //labelRequest.LabelTemplate = "abc.ly";

            LabelRequest result = labelRequest;

            if (!request.IsInternationalOrder)
            {
                result.MailpieceShape     = null;
                result.LabelSubtype       = ConfigManager.Current.DefaultDomesticLabelSubType;
                result.IntegratedFormType = null;
            }
            else
            {
                result.MailpieceShape     = Parsers.ParseMailpieceShape(request.MailPieceShape);
                result.LabelSubtype       = ConfigManager.Current.DefaultInternationalLabelSubType;
                result.IntegratedFormType = PrintLabelsClass.GetIntegratedFormType(request.IsInternationalOrder, request.MailClass, request.MailPieceShape);
            }
            if ((request.PackageDetails.Items == null ? false : request.PackageDetails.Items.Count > 0))
            {
                if (request.IsInternationalOrder)
                {
                    result.CustomsCertify = ConfigManager.Current.DefaultCustomsCertify;
                    result.CustomsSigner  = request.CustomSigner;
                    CustomsInfo customsInfo = new CustomsInfo()
                    {
                        CertificateNumber = request.CustomCertificateNumber,
                        ContentsType      = ConfigManager.Current.DefaultMerchandise,
                        RestrictionType   = ConfigManager.Current.DefaultRestrictionType,
                        InvoiceNumber     = request.InvoiceNumber,
                        NonDeliveryOption = ConfigManager.Current.DefaultNonDeliveryOption
                    };
                    result.CustomsInfo = customsInfo;
                    List <CustomsItem> items = new List <CustomsItem>();
                    foreach (IPackageItem item in request.PackageDetails.Items)
                    {
                        CustomsItem cItem = new CustomsItem()
                        {
                            CountryOfOrigin = item.CustomCountry,
                            Description     = item.Description,
                            Quantity        = item.Quantity,
                            Value           = item.Value,
                            Weight          = item.WeightOz
                        };
                        items.Add(cItem);
                    }
                    result.CustomsInfo.CustomsItems = items.ToArray <CustomsItem>();
                }
            }
            try
            {
                shipDateTime    = request.ShipDateTime;
                result.ShipDate = shipDateTime.ToString("MM/dd/yyyy");
            }
            catch
            {
                shipDateTime    = DateTime.Now;
                result.ShipDate = shipDateTime.ToString("MM/dd/yyyy");
            }
            try
            {
                shipDateTime    = request.ShipDateTime;
                result.ShipTime = shipDateTime.ToString("hh:mm tt");
            }
            catch
            {
                shipDateTime    = DateTime.Now;
                result.ShipDate = shipDateTime.ToString("hh:mm tt");
            }
            return(result);
        }
 public ParcelListResponseExamples(IOptions <ResponseOptions> responseOptionsProvider)
 {
     _responseOptions = responseOptionsProvider.Value;
 }
示例#23
0
 internal static string ConvertResponseToJsonString(ConsistentApiResponse response, ResponseOptions options)
 => JsonConvert.SerializeObject(response, Formatting.Indented, new JsonSerializerSettings()
 {
     Converters = new List <JsonConverter> {
         new StringEnumConverter()
     },
     NullValueHandling = options.IgnoreNullValue ? NullValueHandling.Ignore : NullValueHandling.Include,
     ContractResolver  = options.UseCamelCaseNaming
             ? new CamelCasePropertyNamesContractResolver()
             : new DefaultContractResolver()
 });
示例#24
0
文件: NPC.cs 项目: cvogt/AlbLib
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                if (unknown != null)
                {
                    hashCode += 1000000007 * unknown.GetHashCode();
                }
                hashCode += 1000000009 * Type.GetHashCode();
                hashCode += 1000000021 * Gender.GetHashCode();
                hashCode += 1000000033 * Race.GetHashCode();
                hashCode += 1000000087 * Class.GetHashCode();
                hashCode += 1000000093 * Magic.GetHashCode();
                hashCode += 1000000097 * Level.GetHashCode();
                hashCode += 1000000103 * Language.GetHashCode();
                hashCode += 1000000123 * Appearance.GetHashCode();
                hashCode += 1000000181 * Face.GetHashCode();
                hashCode += 1000000207 * InventoryPicture.GetHashCode();
                hashCode += 1000000223 * ActionPoints.GetHashCode();
                hashCode += 1000000241 * DialogueOptions.GetHashCode();
                hashCode += 1000000271 * ResponseOptions.GetHashCode();
                hashCode += 1000000289 * TrainingPoints.GetHashCode();
                hashCode += 1000000297 * Gold.GetHashCode();
                hashCode += 1000000321 * Rations.GetHashCode();
                hashCode += 1000000349 * Conditions.GetHashCode();
                hashCode += 1000000363 * Strength.GetHashCode();
                hashCode += 1000000403 * Intelligence.GetHashCode();
                hashCode += 1000000409 * Dexterity.GetHashCode();
                hashCode += 1000000411 * Speed.GetHashCode();
                hashCode += 1000000427 * Stamina.GetHashCode();
                hashCode += 1000000433 * Luck.GetHashCode();
                hashCode += 1000000439 * MagicResistance.GetHashCode();
                hashCode += 1000000447 * MagicTallent.GetHashCode();
                hashCode += 1000000453 * CloseRangeCombat.GetHashCode();
                hashCode += 1000000459 * LongRangeCombat.GetHashCode();
                hashCode += 1000000483 * CriticalHit.GetHashCode();
                hashCode += 1000000513 * Lockpicking.GetHashCode();
                hashCode += 1000000531 * LifePoints.GetHashCode();
                hashCode += 1000000579 * SpellPoints.GetHashCode();
                hashCode += 1000000007 * Age.GetHashCode();
                hashCode += 1000000009 * BaseProtection.GetHashCode();
                hashCode += 1000000021 * Protection.GetHashCode();
                hashCode += 1000000033 * BaseDamage.GetHashCode();
                hashCode += 1000000087 * Damage.GetHashCode();
                hashCode += 1000000093 * Experience.GetHashCode();
                if (Spells != null)
                {
                    hashCode += 1000000097 * Spells.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode += 1000000103 * Name.GetHashCode();
                }
                if (SpellStrengths != null)
                {
                    hashCode += 1000000123 * SpellStrengths.GetHashCode();
                }
            }
            return(hashCode);
        }
示例#25
0
 public ArcConfiguration()
 {
     ResponseOptions            = new ResponseOptions();
     ExceptionStatusCodeHandler = new ExceptionStatusCodeHandler();
 }
示例#26
0
 public void SendAllPoolMessage(string poolName, string method, object payload = null, ResponseOptions responseOptions = ResponseOptions.SingleResponse)
 {
     this.SendAllPoolMessage <object>(poolName, method, payload, null, responseOptions);
 }
示例#27
0
 public void SendClientMessage(long clientId, string method, object payload = null, ResponseOptions responseOptions = ResponseOptions.SingleResponse)
 {
     this.SendClientMessage <object>(clientId, method, payload, null, responseOptions);
 }
 public AddressMatchResponseExamples(IOptions <ResponseOptions> options)
 {
     _options = options.Value;
 }
示例#29
0
        /// <typeparam name="TSource"></typeparam>
        /// <typeparam name="TTransform"></typeparam>
        /// <param name="q">A queryable for the data. The properties of this can be marked up with [DataTablesAttribute] to control sorting/searchability/visibility</param>
        /// <param name="dataTableParam"></param>
        /// <param name="transform">//a transform for custom column rendering e.g. to do a custom date row => new { CreatedDate = row.CreatedDate.ToString("dd MM yy") } </param>
        /// <returns></returns>
        public static DataTablesResult <TSource> Create <TSource, TTransform>(IQueryable <TSource> q, DataTablesParam dataTableParam,
                                                                              Func <TSource, TTransform> transform, ResponseOptions <TSource> responseOptions = null)
        {
            var result = new DataTablesResult <TSource>(q, dataTableParam);

            result.Data = result.Data
                          .Transform <TSource, Dictionary <string, object> >(row => TransformTypeInfo.MergeTransformValuesIntoDictionary(transform, row))
                          .Transform <Dictionary <string, object>, Dictionary <string, object> >(StringTransformers.StringifyValues);

            result.Data = ApplyOutputRules(result.Data, responseOptions);

            return(result);
        }
示例#30
0
 public AdresMapper(ResponseOptions responseOptions, ILatestQueries latestQueries)
 {
     _responseOptions = responseOptions;
     _latestQueries   = latestQueries;
 }