Esempio n. 1
0
 internal bool HasOfferRights(
     MediaRightsEnum right,
     ClientTypeEnum clientType,
     PriceTypeEnum priceType)
 {
     return(this.GetOfferRight(right, clientType, priceType) != null);
 }
Esempio n. 2
0
        public WebSocketPrimusServer(string urlPath, ClientTypeEnum clientTypeEnum, Form1 formRef)
            : base(urlPath, false)
        {
            Console.WriteLine($"Primus module started on {this.BaseRoute} !");

            this._formRef   = formRef;
            this.ClientType = clientTypeEnum;
        }
Esempio n. 3
0
 public double GetCallMinuetPrice(ClientTypeEnum clientType)
 {
     if (!prices.ContainsKey((clientType, ServiceType.Call)))
     {
         using (var context = new CellularDbContext())
         {
             var price = context.ClientTypes.Find(clientType).CallMinutesPrice;
             prices[(clientType, ServiceType.Call)] = price;
Esempio n. 4
0
        public decimal DailyValue(int weekDaysCount, int weekendDaysCount, ClientTypeEnum ClientType)
        {
            var totalDays = weekDaysCount + weekendDaysCount;

            if (ClientType == ClientTypeEnum.Fidelity)
            {
                return(((weekDaysCount * FidelityWeekPrice) + (weekendDaysCount * FidelityWeekendPrice)) / totalDays);
            }
            return(((weekDaysCount * RegularWeekPrice) + (weekendDaysCount * RegularWeekendPrice)) / totalDays);
        }
Esempio n. 5
0
 public JustCarpetClient(ILogger logger, HttpClient httpclient = null, ClientTypeEnum clientType = ClientTypeEnum.Live)
 {
     URL = clientType == ClientTypeEnum.Live ?
           "https://justcarpet.azurewebsites.net" :
           "https://localhost:44384";
     _logger     = logger;
     _httpClient = httpclient ?? new HttpClient {
         BaseAddress = new Uri(URL)
     };
 }
Esempio n. 6
0
 public Client(string ID, string FirstName, string LastName, ClientTypeEnum ClientType, string Address, string ContactNumber, DateTime BirthDate)
 {
     this.ID            = ID;
     this.FirstName     = FirstName;
     this.LastName      = LastName;
     this.ClientType    = ClientType;
     this.Address       = Address;
     this.ContactNumber = ContactNumber;
     this.BirthDate     = BirthDate;
 }
Esempio n. 7
0
        private WebServer CreateWebServer(string url, ClientTypeEnum clientTypeEnum)
        {
            var server = new WebServer(o => o
                                       .WithUrlPrefix(url)
                                       .WithMode(HttpListenerMode.EmbedIO))
                         .WithModule(new WebSocketPrimusServer("/primus/", clientTypeEnum, this));

            // Listen for state changes.
            server.StateChanged += (s, e) => $"WebServer New State - {e.NewState}".Info();

            return(server);
        }
Esempio n. 8
0
 internal bool HasRights(ClientTypeEnum clientType)
 {
     if (FeatureEnablement.IsFeatureEnabled(Features.eMarketplace) && this.Rights != null)
     {
         foreach (Right right in Rights)
         {
             if (clientType == right.ClientTypeEnum)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 9
0
 internal Right GetOfferRight(ClientTypeEnum clientType, PriceTypeEnum priceType)
 {
     if (FeatureEnablement.IsFeatureEnabled(Features.eMarketplace) && this.Rights != null)
     {
         foreach (Right right in Rights)
         {
             if (clientType == right.ClientTypeEnum && priceType == right.PriceTypeEnum && Guid.Empty != right.OfferId)
             {
                 return(right);
             }
         }
     }
     return(null);
 }
Esempio n. 10
0
 internal bool HasRights(MediaRightsEnum right, ClientTypeEnum clientType)
 {
     if (FeatureEnablement.IsFeatureEnabled(Features.eMarketplace) && this.Rights != null)
     {
         foreach (Right right1 in Rights)
         {
             if (right == right1.RightEnum && clientType == right1.ClientTypeEnum)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 11
0
 internal Right GetOfferRight(
     MediaRightsEnum right,
     ClientTypeEnum clientType,
     PriceTypeEnum priceType)
 {
     if (FeatureEnablement.IsFeatureEnabled(Features.eMarketplace) && this.Rights != null)
     {
         foreach (Right right1 in Rights)
         {
             if (right == right1.RightEnum && clientType == right1.ClientTypeEnum && (priceType == right1.PriceTypeEnum && Guid.Empty != right1.OfferId))
             {
                 return(right1);
             }
         }
     }
     return(null);
 }
Esempio n. 12
0
        private WebServer CreateWebServer(string url, ClientTypeEnum clientTypeEnum)
        {
            var server = new WebServer(o => o
                                       .WithUrlPrefix(url)
                                       .WithMode(HttpListenerMode.EmbedIO))
                         .WithCors()
                         .WithStaticFolder("/primus/primus.js", "data/primus.js", true, m => m.WithContentCaching(true).WithDefaultExtension(".js"))
                         .WithModule(new WebSocketPrimusServer("/primus/", clientTypeEnum, this))
                         .WithStaticFolder("/", "data/", false);

            // .HandleHttpException(DataResponseForHttpException).HandleUnhandledException(DataResponseForHandleUnhandledException);

            // Listen for state changes.
            server.StateChanged += (s, e) => $"WebServer New State - {e.NewState}".Info();

            return(server);
        }
Esempio n. 13
0
        public static string ToClientTypeString(this ClientTypeEnum clientType)
        {
            switch (clientType)
            {
            case ClientTypeEnum.Bet: return("下注服务端");

            case ClientTypeEnum.Client: return("万利投注软件");

            case ClientTypeEnum.Crawl: return("折扣采集端");

            case ClientTypeEnum.Unknow: return("赔率采集端");

            case ClientTypeEnum.Sell: return("赛事信息采集端");

            default: return("");
            }
        }
Esempio n. 14
0
        public void AddMessageToDataGridView(ClientTypeEnum clientTypeEnum, string message)
        {
            if (!Record || !message.StartsWith("4{"))
            {
                return;
            }

            var time = $"{DateTime.Now.Hour.ToString()}:{DateTime.Now.Minute}";

            this.dataGridView1.Invoke(new Action(() => this.dataGridView1.Rows.Add(new string[]
            {
                time,
                $"{Enum.GetName(typeof(ClientTypeEnum), clientTypeEnum)}",
                message
            })));

            this.dataGridView1.Invoke(new Action(() => dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1));
        }
Esempio n. 15
0
        internal static ClientTypeEnum ToClientType(string value)
        {
            ClientTypeEnum clientTypeEnum = ClientTypeEnum.None;

            if (!string.IsNullOrEmpty(value))
            {
                switch (value)
                {
                case "Zune 3.0":
                    clientTypeEnum = ClientTypeEnum.Zune;
                    break;

                case "WinMobile 7.0":
                case "WinMobile 7.1":
                    clientTypeEnum = ClientTypeEnum.WindowsPhone;
                    break;
                }
            }
            return(clientTypeEnum);
        }
Esempio n. 16
0
        public static ConcurrentDictionary <string, Session> GetClientsGroup(ClientTypeEnum clientType)
        {
            switch (clientType)
            {
            case ClientTypeEnum.Sell:
                return(SellClients);

            case ClientTypeEnum.Crawl:
                return(CrawlerClients);

            case ClientTypeEnum.Bet:
                return(BetClients);

            case ClientTypeEnum.Client:
                return(Clients);

            case ClientTypeEnum.Strategy:
                return(StrategyClients);

            default:
                // 异常情况(可能是需求后期变更,未及时调整这里)
                throw new NotFindSessionException($"未找到{clientType.ToString()}类型的Session");
            }
        }
Esempio n. 17
0
 public ClientEntity(ClientTypeEnum clientType)
 {
     ClientType = clientType;
 }
Esempio n. 18
0
 public Mods.Client SaveClientDetails(int id, string password, string firstName, string lastName, int registeredBy, ClientTypeEnum clientTypeId)
 {
     using (var httpClient = new HttpClient())
     {
         httpClient.BaseAddress = new Uri(URLSERVERBASE);
         httpClient.DefaultRequestHeaders.Clear();
         var clientEdited = new Mods.Client()
         {
             Id           = id,
             FirstName    = firstName,
             LastName     = lastName,
             Password     = password,
             RegisteredBy = registeredBy,
             ClientTypeId = clientTypeId
         };
         var response = httpClient.PutAsJsonAsync("api/Clients/EditClient", clientEdited).Result;
         if (response.IsSuccessStatusCode)
         {
             string jsonResult = response.Content.ReadAsStringAsync().Result;
             return(JsonConvert.DeserializeObject <Cellular.Common.Models.Client>(jsonResult));
         }
         return(null);
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SuggestionListRequest"/> class.
 /// </summary>
 /// <param name="q">Specifies the search to complete.</param>
 /// <param name="client">Determines the type of response you want.</param>
 public SuggestionListRequest(string q, ClientTypeEnum client)
 {
     _q      = q;
     _client = client;
 }
Esempio n. 20
0
 public void AddNewClient(int id, string lastName, string firstName, string password, int employeeId, ClientTypeEnum clientTypeId)
 {
     using (var httpClient = new HttpClient())
     {
         httpClient.BaseAddress = new Uri(URLSERVERBASE);
         var client = new Common.Models.Client()
         {
             Id                = id,
             FirstName         = firstName,
             LastName          = lastName,
             Password          = password,
             RegisterationDate = DateTime.Now,
             RegisteredBy      = employeeId,
             ClientTypeId      = clientTypeId
         };
         httpClient.DefaultRequestHeaders.Clear();
         httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         var response = httpClient.PostAsJsonAsync("api/Clients/AddClient", client).Result;
         if (!response.IsSuccessStatusCode)
         {
             throw new Exception("Can't add this client");
         }
     }
 }
Esempio n. 21
0
        private OutOfPackage GetOutOfPackage(double minuetsDifference, int smsesDifference, ClientTypeEnum clientType)
        {
            var result = new OutOfPackage();

            result.AdditionalMinuets    = minuetsDifference > 0 ? minuetsDifference : 0;
            result.AdditionalSMSes      = smsesDifference > 0 ? smsesDifference : 0;
            result.TotalAdditionalPrice =
                result.AdditionalMinuets * priceList.GetCallMinuetPrice(clientType)
                + result.AdditionalSMSes * priceList.GetSMSPrice(clientType);

            return(result);
        }
Esempio n. 22
0
 /// <summary>
 /// 移除一个Session
 /// </summary>
 /// <param name="clientId"></param>
 /// <param name="clientType"></param>
 /// <exception cref="NotFindSessionException"></exception>
 public static Session RemoveByClientId(string clientId, ClientTypeEnum clientType)
 {
     return(GetClientsGroup(clientType).RemoveByClientId(clientId));
 }