示例#1
0
 public PacketOut(LogonServerOpCode opcode)
     : base(new MemoryStream())
 {
     packetId = new PacketId(opcode);
     Service = ServiceType.Logon;
     this.Write((byte)opcode);
 }
		/// <summary>
		///		Do something to the specified service type.
		/// </summary>
		/// <param name="serviceType">
		///		The service type.
		/// </param>
		public void DoSomethingForService(ServiceType serviceType)
		{
			if (serviceType == ServiceType.None)
				throw new InvalidOperationException("Service type is none.");

			serviceType = ServiceType.None;
		}
示例#3
0
 public PacketOut(WorldServerOpCode opcode)
     : base(new MemoryStream())
 {
     packetId = new PacketId(opcode);
     Service = ServiceType.World;
     this.Write((uint)opcode);
 }
示例#4
0
 public DynDnsUpdater(Dictionary<string,string> args)
 {
     // Parse the arguments by type
     // GANDI & GANDI TEST Environment
     if (args.ContainsKey("ganditest") || args.ContainsKey("gandi"))
     {
         // require apikey, zonename, hostname
         if (args.ContainsKey("apikey")
             && args.ContainsKey("zonename")
             && args.ContainsKey("hostname")
             )
         {
             if (args.ContainsKey("gandi"))
             {
                 _selectedService = ServiceType.Gandi;
                 _gandiConfig.UseTest = false;
             }
             else
             {
                 _selectedService = ServiceType.GandiTest;
                 _gandiConfig.UseTest = true;
             }
             _gandiConfig.ApiKey = args["apikey"];
             _gandiConfig.HostName = args["hostname"];
             _gandiConfig.ZoneName = args["zonename"];
             _gandiConfig.Simulate = args.ContainsKey("simulate");
         }
     }
 }
示例#5
0
 internal ClientCommandEventArgs(string localEndPoint, string remoteEndPoint, ServiceType serviceType, Message requestMessage, DateTime requestTime, Message responseMessage, DateTime responseTime)
     : this(localEndPoint, remoteEndPoint, serviceType, requestMessage, requestTime)
 {
     this.responseMessage = responseMessage;
     this.responseTime = responseTime;
     hasResponse = true;
 }
        public CalculationResult CalculateEmission(DateTime effectiveDate, decimal distance, ServiceType serviceType,
                                                   decimal chargeMass,bool reversal)
        {
            var distanceType = GetDistanceType(distance, serviceType);
            var factorId = FactorMapping[distanceType];
            var factorValue = context.FactorValue(effectiveDate, factorId);
            if (factorValue == null)
            {
                var message = string.Format(Resources.FactorValueNotFound, factorId, effectiveDate);
                throw new NullReferenceException(message);
            }
            var emissions = distance*(chargeMass/1000)*factorValue;
            if (reversal)
            {
                emissions = emissions*-1;
            }
            var calculationDate = context.CalculationDateForFactorId(factorId);

            return new CalculationResult
                {
                    CalculationDate = calculationDate,
                    ActivityGroupId = ActivityMapping[distanceType],
                    Emissions = emissions
                };
        }
        public void ReportServiceDownClientReport(IServiceAddress address, ServiceType type)
        {
            if (log.IsInterestedIn(LogLevel.Information))
                log.Info(string.Format("reportServiceDownClientReport {0} {1}", address, type));

            ReportServiceDown(address, type, ServiceStatus.DownClientReport);
        }
 internal ServiceAnnouncement(UpnpClient client, ServiceType type, string deviceUdn, IEnumerable<string> locations)
 {
     this.client = client;
     this.type = type;
     this.deviceUdn = deviceUdn;
     this.locations = locations;
 }
 public void SaveServiceType(ServiceType servicetypeObj)
 {
     using (var db = new eTempleDbDB())
     {
         db.Save(servicetypeObj);
     }
 }
 public Request(PacketType packetType, string nasIpAddress, ServiceType serviceType, string userName)
 {
     _packet = new Packet(packetType);
     _packet.Attributes.Add(new IpAddressAttribute(AttributeType.NasIpAddress, nasIpAddress));
     _packet.Attributes.Add(new ServiceTypeAttribute(serviceType));
     _packet.Attributes.Add(new StringAttribute(AttributeType.UserName, userName));
 }
 public int UpdateServiceType(ServiceType servicetypeObj)
 {
     using (var db = new eTempleDbDB())
     {
         return db.Update(servicetypeObj);
     }
 }
示例#12
0
        public static List<string> WhereNot(ServiceType serviceType) {
            _whereNot.Add("is_dead");

            switch(serviceType) {
                case ServiceType.Store:
                    _whereNot.Add("has_wheelchair_accessability");
                    _whereNot.Add("has_bilingual_services");
                    _whereNot.Add("has_product_consultant");
                    _whereNot.Add("has_tasting_bar");
                    _whereNot.Add("has_beer_cold_room");
                    _whereNot.Add("has_special_occasion_permits");
                    _whereNot.Add("has_vintages_corner");
                    _whereNot.Add("has_parking");
                    _whereNot.Add("has_transit_access");

                    break;
                case ServiceType.Product:
                    _where.Add("is_discontinued");
                    _where.Add("has_value_added_promotion");
                    _where.Add("has_limited_time_offer");
                    _where.Add("has_bonus_reward_miles");
                    _where.Add("is_seasonal");
                    _where.Add("is_vqa");
                    _where.Add("is_ocb");
                    _where.Add("is_kosher");

                    break;
            }

            return _whereNot;
        }
        public static ServiceController Create(string machineName, string serviceName, string displayName,
                                               ServiceType serviceType, ServiceStartMode startType,
                                               ServiceErrorControl errorControl, string binaryPathName,
                                               string loadOrderGroup, string[] dependencies, string serviceStartName,
                                               string password)
        {
            var hScManager = OpenSCManager(machineName, null, ScmAccessRights.CreateService);
            if (hScManager == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
            try
            {
                var dependencyList = dependencies == null || dependencies.Length == 0
                                         ? null
                                         : string.Join("\0", dependencies);
                var hService = CreateService(hScManager, serviceName, displayName, ServiceAccessRights.AllAccess,
                                             serviceType, startType, errorControl, binaryPathName, loadOrderGroup,
                                             IntPtr.Zero, dependencyList, serviceStartName, password);
                if (hService == IntPtr.Zero)
                {
                    throw new Win32Exception();
                }
                CloseServiceHandle(hService);

                return new ServiceController(serviceName, machineName);
            }
            finally
            {
                CloseServiceHandle(hScManager);
            }
        }
 protected BaseCall(string phoneNumber, string fromCountry, string toCountry, ServiceType callType)
 {
     Type = callType;
     PhoneNumber = phoneNumber;
     FromCountry = fromCountry;
     ToCountry = toCountry;
 }
 internal ServiceStatusEventArgs(IServiceAddress serviceAddress, ServiceType serviceType, ServiceStatus oldStatus, ServiceStatus newStatus)
 {
     this.serviceAddress = serviceAddress;
     this.serviceType = serviceType;
     this.oldStatus = oldStatus;
     this.newStatus = newStatus;
 }
 public ActivityData(
     string id, string html = null, string text = null, StyleElement parsedText = null, bool? isEditable = null, Uri postUrl = null,
     int? commentLength = null, CommentData[] comments = null,
     DateTime? postDate = null,
     DateTime? editDate = null,
     ServiceType serviceType = null, PostStatusType? status = null, IAttachable attachedContent = null,
     ProfileData owner = null, DateTime? getActivityDate = null,
     ActivityUpdateApiFlag updaterTypes = ActivityUpdateApiFlag.Unloaded)
 {
     LoadedApiTypes = updaterTypes;
     Id = id;
     IsEditable = isEditable;
     Html = html;
     Text = text;
     ParsedText = parsedText;
     CommentLength = commentLength;
     Comments = comments;
     PostUrl = postUrl;
     PostDate = postDate;
     EditDate = editDate;
     GetActivityDate = getActivityDate;
     PostStatus = status;
     Owner = owner;
     AttachedContent = attachedContent;
     ServiceType = serviceType;
 }
示例#17
0
        IMessageProcessor IServiceConnector.Connect(IServiceAddress address, ServiceType type)
        {
            if (!connected) {
                if (!OnConnect(address, type)) {
                    logger.Warning(this, "Unable to connect to '" + address + "' after check.");
                    return null;
                }

                try {
                    processor = Connect(address, type);
                } catch (Exception e) {
                    logger.Error(this, "Error while connecting.", e);
                    throw;
                }

                connected = true;

                if (processor == null) {
                    logger.Error(this, "It was not possible to obtain a valid message processor for the connection.");

                    connected = false;
                    throw new InvalidOperationException("Was not able to connect.");
                }

                OnConnected(address, type);

                logger.Info(this, "Connected to '" + address + "'.");
            }

            return processor;
        }
示例#18
0
 public void CopyFrom(UnionPsService unionPsService)
 {
     this.m_BodyLoss = unionPsService.BodyLoss;
     this.m_DlActivity = unionPsService.DlActivity;
     this.m_DlAveThroughputDemand = unionPsService.DlAveThroughputDemand;
     this.m_DlMaxThroughputDemand = unionPsService.DlMaxThroughputDemand;
     this.m_DlMinThroughputDemand = unionPsService.DlMinThroughputDemand;
     this.m_DlTxEff = unionPsService.DlTxEff;
     this.UlOffset = unionPsService.UlOffset;
     this.DlOffset = unionPsService.DlOffset;
     this.m_Name = unionPsService.Name;
     this.UlAMRRate = unionPsService.UlAMRRate;
     this.DlAMRRate = unionPsService.DlAMRRate;
     this.m_PSServiceDic.Clear();
     foreach (KeyValuePair<NetWorkType, Service> pair in unionPsService.PSServiceDic)
     {
         this.m_PSServiceDic.Add(pair.Key, pair.Value);
     }
     this.m_Technology = unionPsService.Technology;
     this.m_Type = unionPsService.Type;
     this.m_UlActivity = unionPsService.UlActivity;
     this.m_UlAveThroughputDemand = unionPsService.UlAveThroughputDemand;
     this.m_UlMaxThroughputDemand = unionPsService.UlMaxThroughputDemand;
     this.m_UlMinThroughputDemand = unionPsService.UlMinThroughputDemand;
     this.m_UlTxEff = unionPsService.UlTxEff;
 }
示例#19
0
        private async Task<ExtAccount> _GetAccountInfo(ServiceType type, AccessResponse access)
        {
            if (access == null) throw new ArgumentNullException("access");

            var config = _openIdConfigService.GetConfig(type);

            string url = config.GetUserInfoQueryUrl(access.access_token);
            WebRequest request = WebRequest.Create(new Uri(url)) as HttpWebRequest;
            if (request == null) return null;

            request.Method = WebRequestMethods.Http.Get;

            WebResponse response = await request.GetResponseAsync();
            string responseContent = _ReadStreamFromResponse(response);

            var responseObj = JsonConvert.DeserializeObject(responseContent, Type.GetType(config.UserInfoObjectType)) as IUserInfoResponse;

            if (responseObj == null) return null;

            ExtAccount extAccount = responseObj.ToAccount();
            //externalUserInfo.AccessToken = access.access_token;
            //externalUserInfo.ExpiresIn = access.expires_in;
            //externalUserInfo.LastAccess = DateTime.Now;

            return extAccount;
        }
        public override void Context()
        {
            base.Context();
            _serviceType = new ServiceType();
            WindsorContainer.Stub(x => x.Resolve<IServiceType>()).Return(_serviceType);

            _result = CastleContainer.Resolve<IServiceType>();
        }
 private void LoadCatalogService()
 {        
     this.serviceType = ServiceTypeService.GetServiceType(this.serviceTypeId);
     if (this.serviceType != null)
     {
         this.inputNameCatalog.Value = this.serviceType.ServiceTypeDescription;            
     }
 }
 internal ClientCommandEventArgs(string localEndPoint, string remoteEndPoint, ServiceType serviceType, IEnumerable<Message> requestMessage, DateTime requestTime)
 {
     this.localEndPoint = localEndPoint;
     this.remoteEndPoint = remoteEndPoint;
     this.serviceType = serviceType;
     this.requestTime = requestTime;
     this.requestMessage = requestMessage;
 }
 protected BaseCharge(string phoneNumber, ServiceType typeOfService, decimal chargePrUnit, string description, string country)
 {
     Country = country;
     Description = string.Format("({0}) {1}",country, description);
     PhoneNumber = phoneNumber;
     ServiceType = typeOfService;
     ChargePrUnit = chargePrUnit;
 }
		public override IService GetService(ServiceType serviceType)
		{
			if (serviceType.Is(typeof(INativePathService)))
			{
				return this;
			}

			return base.GetService(serviceType);
		}
        public void AddService()
        {
            var servicetype = new ServiceType(){Name = Name, Price = Price};

            _esClinicContext.ServiceTypes.Add(servicetype);
            _esClinicContext.SaveChanges();

            ServiceTypes.Add(servicetype);
        }
        public string GetEndPoint(ServiceType type, Operation operation)
        {
            string endPoint = serviceConfig.ToList().Find(x => x.Key == type).Value.PathAndQuery.ToString().Replace(ServiceUrl, "") + operation.GetValueAsString();

             if (endPoint.IndexOf(Constants.userid) > 0)
            endPoint = endPoint.Replace(Constants.userid, UserId);

             return endPoint;
        }
		public override IService GetService(ServiceType serviceType)
		{
			if (serviceType is DirectoryHashingServiceType)
			{
				return new NetworkDirectoryHashingService(this, (DirectoryHashingServiceType)serviceType);
			}

			return base.GetService(serviceType);
		}
示例#28
0
        public override void Context()
        {
            base.Context();
            _serviceType = new ServiceType();
            _iServiceType = typeof(IServiceType);
            Container.Stub(x => x.Resolve(_iServiceType)).Return(_serviceType);

            _result = IoC.Resolve(_iServiceType);
        }
 /// <summary>
 /// Reads <see cref="RemoteServiceSettings"/> from provided <see cref="Packet"/> struct.
 /// </summary>
 /// <param name="p"><see cref="Packet"/> to read <see cref="RemoteServiceSettings"/> from.</param>
 /// <param name="t">Remote <see cref="ServiceType"/>.</param>
 /// <returns>><see cref="RemoteServiceSettings"/> readed from provided <see cref="Packet"/>.</returns>
 public static RemoteServiceSettings FromPacket( Packet p, ServiceType t )
 {
     switch ( t )
     {
         case ServiceType.LoginService:
             return new LoginServiceSettings(p.ReadByte(), p.InternalReadBool(), p.ReadByte());
         default:
             return null;
     }
 }
示例#30
0
文件: Token.cs 项目: bfhhq/csharp-sdk
        public static String CreateQueryToken(String accessKey, String secretKey, ServiceType serviceType, string fileName, string fileKey)
        {
            Dictionary<string, object> jsonObj = new Dictionary<string, object>();

            jsonObj.Add("servicetype", (int)serviceType);
            jsonObj.Add("filekey", fileKey);
            jsonObj.Add("filename", fileName);

            return CreateToken(jsonObj, secretKey, accessKey, /*timeoutSec*/0);
        }
示例#31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeSiteSettingService" /> class.
 /// </summary>
 /// <param name="enableChangeTitle">enableChangeTitle.</param>
 /// <param name="enableChangeDescription">enableChangeDescription.</param>
 /// <param name="changeMetadataSettings">changeMetadataSettings.</param>
 /// <param name="deploymentManagerPlanSettings">deploymentManagerPlanSettings.</param>
 /// <param name="enableChangeHubSite">enableChangeHubSite.</param>
 /// <param name="scopeSettings">scopeSettings.</param>
 /// <param name="departmentAssignBy">departmentAssignBy.</param>
 /// <param name="metadatas">metadatas.</param>
 /// <param name="hideRequestSummary">hideRequestSummary.</param>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="type">type.</param>
 /// <param name="department">department.</param>
 /// <param name="loadDepartmentFromUps">loadDepartmentFromUps.</param>
 /// <param name="departments">departments.</param>
 /// <param name="serviceContact">serviceContact.</param>
 /// <param name="serviceAdminContact">serviceAdminContact.</param>
 /// <param name="approversContainManagerRole">approversContainManagerRole.</param>
 /// <param name="status">status.</param>
 /// <param name="showServiceInCatalog">showServiceInCatalog.</param>
 /// <param name="customActions">customActions.</param>
 /// <param name="approvalProcessId">approvalProcessId.</param>
 /// <param name="languageId">languageId.</param>
 /// <param name="categoryId">categoryId.</param>
 public ChangeSiteSettingService(bool enableChangeTitle = default(bool), bool enableChangeDescription = default(bool), ChangeMetadataActionSetting changeMetadataSettings = default(ChangeMetadataActionSetting), DpmServiceSetting deploymentManagerPlanSettings = default(DpmServiceSetting), bool enableChangeHubSite = default(bool), ServiceScopeSettings scopeSettings = default(ServiceScopeSettings), AssignBy departmentAssignBy = default(AssignBy), List <CustomMetadata> metadatas = default(List <CustomMetadata>), bool hideRequestSummary = default(bool), Guid id = default(Guid), string name = default(string), string description = default(string), ServiceType type = default(ServiceType), string department = default(string), bool loadDepartmentFromUps = default(bool), List <string> departments = default(List <string>), ApiUser serviceContact = default(ApiUser), ApiUser serviceAdminContact = default(ApiUser), bool approversContainManagerRole = default(bool), CommonStatus status = default(CommonStatus), bool showServiceInCatalog = default(bool), CustomActionSettings customActions = default(CustomActionSettings), Guid approvalProcessId = default(Guid), int languageId = default(int), string categoryId = default(string))
 {
     this.EnableChangeTitle             = enableChangeTitle;
     this.EnableChangeDescription       = enableChangeDescription;
     this.ChangeMetadataSettings        = changeMetadataSettings;
     this.DeploymentManagerPlanSettings = deploymentManagerPlanSettings;
     this.EnableChangeHubSite           = enableChangeHubSite;
     this.ScopeSettings      = scopeSettings;
     this.DepartmentAssignBy = departmentAssignBy;
     this.Metadatas          = metadatas;
     this.HideRequestSummary = hideRequestSummary;
     this.Id                          = id;
     this.Name                        = name;
     this.Description                 = description;
     this.Type                        = type;
     this.Department                  = department;
     this.LoadDepartmentFromUps       = loadDepartmentFromUps;
     this.Departments                 = departments;
     this.ServiceContact              = serviceContact;
     this.ServiceAdminContact         = serviceAdminContact;
     this.ApproversContainManagerRole = approversContainManagerRole;
     this.Status                      = status;
     this.ShowServiceInCatalog        = showServiceInCatalog;
     this.CustomActions               = customActions;
     this.ApprovalProcessId           = approvalProcessId;
     this.LanguageId                  = languageId;
     this.CategoryId                  = categoryId;
 }
        public static Transaction CreateTransaction(string transactioinID, CustomerAccount customer, CustomerAccountAddress customerAddress, string billingID,
                                                    EnumTransactionType transactionType, decimal policyWaybillCharge, ServiceType serviceType, decimal serviceTypeCharge,
                                                    decimal vatCharge, string batchTransactionID)
        {
            Transaction newTransaction = new Transaction();

            newTransaction.TransactionID = transactioinID;
            newTransaction.CustomerGUID  = customer.GUID;
            newTransaction.CustomerAccountAddressGUID = customerAddress.GUID;
            newTransaction.BillingAccountID           = billingID;
            newTransaction.TransactionType            = transactionType.ToString();
            newTransaction.PolicyWayBillCharge        = policyWaybillCharge;
            newTransaction.ServiceTypeGUID            = serviceType.GUID;
            newTransaction.ServiceTypeCharge          = serviceTypeCharge;
            newTransaction.TimeStamp          = DateTime.Now;
            newTransaction.VATCharge          = vatCharge;
            newTransaction.BatchTransactionID = batchTransactionID;

            newTransaction.CustomerAccount        = customer;
            newTransaction.CustomerAccountAddress = customerAddress;
            newTransaction.ServiceType            = serviceType;

            return(newTransaction);
        }
示例#33
0
 public override string ToString()
 {
     return($"{nameof(ServiceType)}: {ServiceType.FullNameInCode()}");
 }
        protected override IEnumerable<Instance> createPlan(ServiceGraph services)
        {
            _inner = services.FindInstance(ServiceType, _instanceKey);
            if (_inner == null) throw new InvalidOperationException($"Referenced instance of {ServiceType.FullNameInCode()} named '{_instanceKey}' does not exist");
            
            _inner.Parent = Parent;
            Lifetime = _inner.Lifetime;

            yield return _inner;
        }
示例#35
0
 /// <summary>
 /// 注册服务
 /// </summary>
 /// <param name="serviceKey">服务标识</param>
 /// <param name="serviceName">名称</param>
 /// <param name="description">描述信息</param>
 /// <param name="serviceType">服务类型</param>
 /// <param name="type">反射类型</param>
 private void RegisterService(string serviceKey, string serviceName, string description, ServiceType serviceType, Type type, ServiceScope serviceScope)
 {
     logger.Debug("接收到子系统[" + serviceName + "]的注册请求");
     if (subsystems.ContainsKey(serviceKey))
     {
         throw new ArgumentException("SystemManager中已经存在Key为[" + serviceKey + "]的子系统信息", "subsystemKey");
     }
     subsystems.Add(serviceKey, new ServiceInfo(serviceKey, serviceName, description, serviceType, type, serviceScope));
 }
示例#36
0
        private static void OnQueryRecordReply(ServiceRef sdRef, ServiceFlags flags, uint interfaceIndex,
                                               ServiceError errorCode, string fullname, ServiceType rrtype, ServiceClass rrclass, ushort rdlen,
                                               IntPtr rdata, uint ttl, IntPtr context)
        {
            var handle        = GCHandle.FromIntPtr(context);
            var browseService = handle.Target as BrowseService;

            switch (rrtype)
            {
            case ServiceType.A:
                IPAddress address;

                if (rdlen == 4)
                {
                    // ~4.5 times faster than Marshal.Copy into byte[4]
                    uint address_raw = (uint)(Marshal.ReadByte(rdata, 3) << 24);
                    address_raw |= (uint)(Marshal.ReadByte(rdata, 2) << 16);
                    address_raw |= (uint)(Marshal.ReadByte(rdata, 1) << 8);
                    address_raw |= (uint)Marshal.ReadByte(rdata, 0);

                    address = new IPAddress(address_raw);
                }
                else if (rdlen == 16)
                {
                    byte [] address_raw = new byte[rdlen];
                    Marshal.Copy(rdata, address_raw, 0, rdlen);
                    address = new IPAddress(address_raw, interfaceIndex);
                }
                else
                {
                    break;
                }

                if (browseService.hostentry == null)
                {
                    browseService.hostentry          = new IPHostEntry();
                    browseService.hostentry.HostName = browseService.hosttarget;
                }

                if (browseService.hostentry.AddressList != null)
                {
                    ArrayList list = new ArrayList(browseService.hostentry.AddressList);
                    list.Add(address);
                    browseService.hostentry.AddressList = list.ToArray(typeof(IPAddress)) as IPAddress [];
                }
                else
                {
                    browseService.hostentry.AddressList = new IPAddress [] { address };
                }

                ServiceResolvedEventHandler handler = browseService._resolved;
                if (handler != null)
                {
                    handler(browseService, new ServiceResolvedEventArgs(browseService));
                }

                break;

            case ServiceType.TXT:
                if (browseService.TxtRecord != null)
                {
                    browseService.TxtRecord.Dispose();
                }

                browseService.TxtRecord = new TxtRecord(rdlen, rdata);
                break;

            default:
                break;
            }

            sdRef.Deallocate();
        }
示例#37
0
 /// <summary>
 ///  如果实验的所有逻辑都由组件完成,这个函数是为外部提供的,因此,将不被调用
 ///
 ///  这里由外部发送一个请求消息,有时候不需要返回数据,有时候用户希望返回数据
 /// </summary>
 /// <param name="SType"></param>
 /// <param name="fileName"></param>
 /// <param name="url"></param>
 /// <returns></returns>
 public static T RequestWebHostData <T>(ServiceType SType, string fileName, string url = null) where T : class
 {
     return(new DataProcurement().GetDataFromWebHost <T>(fileName, url));
 }
示例#38
0
 /// <summary>
 /// Sets service type which used by builder for make proper shell instance.
 /// </summary>
 /// <param name="serviceType">Type of the service pipeline.</param>
 public void SetServiceType(ServiceType serviceType)
 {
     _result.ServiceType = serviceType;
 }
示例#39
0
        internal static TimestampFormat GetDefaultTimestampFormat(MarshallLocation marshallLocation, ServiceType serviceType)
        {
            // Rules used to default the format if timestampFormat is not specified.
            // 1. All timestamp values serialized in HTTP headers are formatted using rfc822 by default.
            // 2. All timestamp values serialized in query strings are formatted using iso8601 by default.
            if (marshallLocation == MarshallLocation.Header)
            {
                return(TimestampFormat.RFC822);
            }
            else if (marshallLocation == MarshallLocation.QueryString)
            {
                return(TimestampFormat.ISO8601);
            }
            else
            {
                // Return protocol defaults if marshall location is not header or querystring.
                // The default timestamp formats per protocol for structured payload shapes are as follows.
                //     rest-json: unixTimestamp
                //     jsonrpc: unixTimestamp
                //     rest-xml: iso8601
                //     query: iso8601
                //     ec2: iso8601
                switch (serviceType)
                {
                case ServiceType.Rest_Json:
                    return(TimestampFormat.UnixTimestamp);

                case ServiceType.Json:
                    return(TimestampFormat.UnixTimestamp);

                case ServiceType.Query:
                    return(TimestampFormat.ISO8601);

                case ServiceType.Rest_Xml:
                    return(TimestampFormat.ISO8601);

                default:
                    throw new InvalidOperationException(
                              "Encountered unknown model type (protocol): " + serviceType);
                }
            }
        }
示例#40
0
 public bool IsServiceUp(IServiceAddress address, ServiceType type)
 {
     return(GetServiceCurrentStatus(address, type) == ServiceStatus.Up);
 }
示例#41
0
 public TrackedService(IServiceAddress serviceAddress, ServiceType serviceType, ServiceStatus currentStatus)
 {
     this.serviceAddress = serviceAddress;
     this.serviceType    = serviceType;
     this.currentStatus  = currentStatus;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="serviceType"></param>
 /// <param name="instanceType"></param>
 public ServiceContractAttribute(string name, ServiceType serviceType, InstanceType instanceType)
 {
     Name         = name;
     InstanceType = instanceType;
     ServiceType  = serviceType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateListService" /> class.
 /// </summary>
 /// <param name="enableNavigation">enableNavigation.</param>
 /// <param name="defaultListType">defaultListType.</param>
 /// <param name="versionSettings">versionSettings.</param>
 /// <param name="listTemplateSettings">listTemplateSettings.</param>
 /// <param name="urlSettings">urlSettings.</param>
 /// <param name="allowBreakPermissionInheritance">allowBreakPermissionInheritance.</param>
 /// <param name="permissionSettings">permissionSettings.</param>
 /// <param name="scopeSettings">scopeSettings.</param>
 /// <param name="listVersionAssignBy">listVersionAssignBy.</param>
 /// <param name="listTemplateAssignBy">listTemplateAssignBy.</param>
 /// <param name="navigationAssignBy">navigationAssignBy.</param>
 /// <param name="listTypeAssignBy">listTypeAssignBy.</param>
 /// <param name="departmentAssignBy">departmentAssignBy.</param>
 /// <param name="metadatas">metadatas.</param>
 /// <param name="hideRequestSummary">hideRequestSummary.</param>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="type">type.</param>
 /// <param name="department">department.</param>
 /// <param name="loadDepartmentFromUps">loadDepartmentFromUps.</param>
 /// <param name="departments">departments.</param>
 /// <param name="serviceContact">serviceContact.</param>
 /// <param name="serviceAdminContact">serviceAdminContact.</param>
 /// <param name="approversContainManagerRole">approversContainManagerRole.</param>
 /// <param name="status">status.</param>
 /// <param name="showServiceInCatalog">showServiceInCatalog.</param>
 /// <param name="customActions">customActions.</param>
 /// <param name="approvalProcessId">approvalProcessId.</param>
 /// <param name="languageId">languageId.</param>
 /// <param name="categoryId">categoryId.</param>
 public CreateListService(bool enableNavigation = default(bool), ListType defaultListType = default(ListType), ListVersionSettings versionSettings = default(ListVersionSettings), ListTemplateSettings listTemplateSettings = default(ListTemplateSettings), CreateListUrlSettings urlSettings = default(CreateListUrlSettings), bool allowBreakPermissionInheritance = default(bool), PermissionSettings permissionSettings = default(PermissionSettings), ServiceScopeSettings scopeSettings = default(ServiceScopeSettings), AssignBy listVersionAssignBy = default(AssignBy), AssignBy listTemplateAssignBy = default(AssignBy), AssignBy navigationAssignBy = default(AssignBy), AssignBy listTypeAssignBy = default(AssignBy), AssignBy departmentAssignBy = default(AssignBy), List <CustomMetadata> metadatas = default(List <CustomMetadata>), bool hideRequestSummary = default(bool), Guid id = default(Guid), string name = default(string), string description = default(string), ServiceType type = default(ServiceType), string department = default(string), bool loadDepartmentFromUps = default(bool), List <string> departments = default(List <string>), ApiUser serviceContact = default(ApiUser), ApiUser serviceAdminContact = default(ApiUser), bool approversContainManagerRole = default(bool), CommonStatus status = default(CommonStatus), bool showServiceInCatalog = default(bool), CustomActionSettings customActions = default(CustomActionSettings), Guid approvalProcessId = default(Guid), int languageId = default(int), string categoryId = default(string))
 {
     this.VersionSettings      = versionSettings;
     this.ListTemplateSettings = listTemplateSettings;
     this.UrlSettings          = urlSettings;
     this.PermissionSettings   = permissionSettings;
     this.ScopeSettings        = scopeSettings;
     this.Metadatas            = metadatas;
     this.Name                            = name;
     this.Description                     = description;
     this.Department                      = department;
     this.Departments                     = departments;
     this.ServiceContact                  = serviceContact;
     this.ServiceAdminContact             = serviceAdminContact;
     this.CustomActions                   = customActions;
     this.CategoryId                      = categoryId;
     this.EnableNavigation                = enableNavigation;
     this.DefaultListType                 = defaultListType;
     this.VersionSettings                 = versionSettings;
     this.ListTemplateSettings            = listTemplateSettings;
     this.UrlSettings                     = urlSettings;
     this.AllowBreakPermissionInheritance = allowBreakPermissionInheritance;
     this.PermissionSettings              = permissionSettings;
     this.ScopeSettings                   = scopeSettings;
     this.ListVersionAssignBy             = listVersionAssignBy;
     this.ListTemplateAssignBy            = listTemplateAssignBy;
     this.NavigationAssignBy              = navigationAssignBy;
     this.ListTypeAssignBy                = listTypeAssignBy;
     this.DepartmentAssignBy              = departmentAssignBy;
     this.Metadatas                       = metadatas;
     this.HideRequestSummary              = hideRequestSummary;
     this.Id                          = id;
     this.Name                        = name;
     this.Description                 = description;
     this.Type                        = type;
     this.Department                  = department;
     this.LoadDepartmentFromUps       = loadDepartmentFromUps;
     this.Departments                 = departments;
     this.ServiceContact              = serviceContact;
     this.ServiceAdminContact         = serviceAdminContact;
     this.ApproversContainManagerRole = approversContainManagerRole;
     this.Status                      = status;
     this.ShowServiceInCatalog        = showServiceInCatalog;
     this.CustomActions               = customActions;
     this.ApprovalProcessId           = approvalProcessId;
     this.LanguageId                  = languageId;
     this.CategoryId                  = categoryId;
 }
 public ServiceWrapper(ServiceType serviceType, object service)
 {
     ServiceType = serviceType;
     Service     = service;
 }
示例#45
0
        /// <summary>
        /// 获取特定的已经注册的服务
        /// </summary>
        /// <param name="serviceType"></param>
        /// <returns></returns>
        public async Task <List <Tuple <string, ServiceStatusEnum> > > ListRegisteredService(ServiceType serviceType)
        {
            var allService = await ListAllRegisteredService();

            return(allService[serviceType]);
        }
示例#46
0
        public void InsertAndLoadDocument()
        {
            var aboard                = true;
            var issueDateValidFrom    = new DateTime(2013, 11, 11);
            var issueDateValidTo      = new DateTime(2013, 12, 12);
            var issueNotify           = 5;
            var issueValidTo          = true;
            var revisionDateValidFrom = new DateTime(2014, 11, 11);
            var revisionDateValidTo   = new DateTime(2014, 12, 12);
            var revisioNotify         = 1;
            var revisioValidTo        = false;
            var prolongationWay       = ProlongationWay.Manually;



            var nomenclature = new Nomenclatures
            {
                FullName   = "TestDocument",
                Department = Department.Unknown
            };

            var department = new Department
            {
                FullName = "TestDocument"
            };

            var serciceType = new ServiceType
            {
                FullName  = "TestDocument",
                ShortName = "TestDocument"
            };

            var document = new Document
            {
                Aboard              = aboard,
                IssueDateValidFrom  = issueDateValidFrom,
                IssueDateValidTo    = issueDateValidTo,
                IssueNotify         = issueNotify,
                IssueValidTo        = issueValidTo,
                RevisionDateFrom    = revisionDateValidFrom,
                RevisionDateValidTo = revisionDateValidTo,
                RevisionNotify      = revisioNotify,
                RevisionValidTo     = revisioValidTo,
                Nomenсlature        = nomenclature,
                Department          = department,
                ServiceType         = serciceType,
                ProlongationWay     = prolongationWay,
                DocumentSubType     = DocumentSubType.Unknown
            };

            var enviroment = GetEnviroment();

            enviroment.NewKeeper.Save(nomenclature);
            enviroment.NewKeeper.Save(department);
            enviroment.NewKeeper.Save(serciceType);
            enviroment.NewKeeper.Save(document);

            var forCheckDocument = enviroment.NewLoader.GetObjectListAll <DocumentDTO, Document>(new Filter("ItemId", document.ItemId), true).SingleOrDefault();

            enviroment.NewKeeper.Delete(nomenclature);
            enviroment.NewKeeper.Delete(department);
            enviroment.NewKeeper.Delete(serciceType);
            enviroment.NewKeeper.Delete(document);

            Assert.IsTrue(forCheckDocument != null, "forCheckDocument не должен быть пустым");
            Assert.AreEqual(aboard, forCheckDocument.Aboard);
            Assert.AreEqual(issueDateValidFrom, forCheckDocument.IssueDateValidFrom);
            Assert.AreEqual(issueDateValidTo, forCheckDocument.IssueDateValidTo);
            Assert.AreEqual(issueNotify, forCheckDocument.IssueNotify);
            Assert.AreEqual(issueValidTo, forCheckDocument.IssueValidTo);
            Assert.AreEqual(revisionDateValidFrom, forCheckDocument.RevisionDateFrom);
            Assert.AreEqual(revisionDateValidTo, forCheckDocument.RevisionDateValidTo);
            Assert.AreEqual(revisioNotify, forCheckDocument.RevisionNotify);
            Assert.AreEqual(revisioValidTo, forCheckDocument.RevisionValidTo);
            Assert.AreEqual(prolongationWay, forCheckDocument.ProlongationWay);

            Assert.IsTrue(forCheckDocument.Nomenсlature != null, "Nomenсlature не должен быть пустым");
            Assert.AreEqual("TestDocument", forCheckDocument.Nomenсlature.FullName);

            Assert.IsTrue(forCheckDocument.Department != null, "Department не должен быть пустым");
            Assert.AreEqual("TestDocument", forCheckDocument.Department.FullName);

            Assert.IsTrue(forCheckDocument.ServiceType != null, "ServiceType не должен быть пустым");
            Assert.AreEqual("TestDocument", forCheckDocument.ServiceType.FullName);
        }
示例#47
0
        public void CreateShipmentRequest()
        {
            try
            {
                ShipService     shipService     = new ShipService();
                ShipmentRequest shipmentRequest = new ShipmentRequest();

                // Security
                UPSSecurity upss = new UPSSecurity();
                UPSSecurityServiceAccessToken upssSvcAccessToken = new UPSSecurityServiceAccessToken
                {
                    AccessLicenseNumber = "1CBF3AD5FB29C105"
                };
                upss.ServiceAccessToken = upssSvcAccessToken;
                UPSSecurityUsernameToken upssUsrNameToken = new UPSSecurityUsernameToken();
                if (radioButton_PLZFT.Checked == true)
                {
                    upssUsrNameToken.Username = "******";
                    upssUsrNameToken.Password = "******";
                }
                else
                {
                    upssUsrNameToken.Username = "******";   // AAC
                    upssUsrNameToken.Password = "******"; // AAC
                }
                upss.UsernameToken           = upssUsrNameToken;
                shipService.UPSSecurityValue = upss;

                // Request
                RequestType request = new RequestType();
                shipmentRequest.Request = request;

                // Request Option
                String[] requestOption = { "nonvalidate" };
                request.RequestOption   = requestOption;
                shipmentRequest.Request = request;

                // Shipment
                ShipmentType shipment = new ShipmentType();
                shipment.Description = "Amazon Gift Card";

                // Shipper
                ShipperType shipper = new ShipperType();
                //shipper.ShipperNumber = "9E6741";
                //if (radioButton_PLZFT.Checked == true)
                shipper.ShipperNumber = "9E6741";     // <- gleich dem im AccessToken !?
                //else
                // 9E6741
                //    shipper.ShipperNumber = "9E6741"; // <- gleich dem im AccessToken !?

                // Payment Info
                PaymentInfoType paymentInfo = new PaymentInfoType();


                ShipmentChargeType shipmentCharge = new ShipmentChargeType();
                shipmentCharge.Type = "01";

                //Payment Info -> BillShipper
                BillShipperType billShipper = new BillShipperType();
                //billShipper.AccountNumber = "9E6741";
                billShipper.AccountNumber  = "587997";
                shipmentCharge.BillShipper = billShipper;


                ShipmentChargeType shipmentCharge2 = new ShipmentChargeType();
                shipmentCharge2.Type = "02";

                // Payment Info -> BillReceiver
                BillReceiverType billReceiver = new BillReceiverType();
                billReceiver.AccountNumber   = "9E6741";
                shipmentCharge2.BillReceiver = billReceiver;

                // Payment Info -> Bill3rdParty
                //BillThirdPartyChargeType bill3rdParty = new BillThirdPartyChargeType();
                //bill3rdParty.AccountNumber = "9E6741";
                //AccountAddressType thirdPartyAddress = new AccountAddressType
                //{
                //    PostalCode = "94032",
                //    CountryCode = "DE"
                //};
                //bill3rdParty.Address = thirdPartyAddress;
                //shipmentCharge2.BillThirdParty = bill3rdParty;



                ShipmentChargeType[] shpmentChargeArray = { shipmentCharge, shipmentCharge2 };
                //ShipmentChargeType[] shpmentChargeArray = { shipmentCharge2 };
                //ShipmentChargeType[] shpmentChargeArray = { shipmentCharge2 };
                paymentInfo.ShipmentCharge = shpmentChargeArray;


                // Shipment -> Payment Information
                shipment.PaymentInformation = paymentInfo;

                // Shipper
                UPS_API.ShipWebReference.ShipAddressType shipperAddress = new UPS_API.ShipWebReference.ShipAddressType();
                String[] addressLine = { textBox_Shipper_AddressLine.Text };
                shipperAddress.AddressLine       = addressLine;
                shipperAddress.City              = textBox_Shipper_City.Text;
                shipperAddress.PostalCode        = textBox_Shipper_PostalCode.Text;
                shipperAddress.StateProvinceCode = textBox_Shipper_StateProvince.Text;
                shipperAddress.CountryCode       = textBox_Shipper_CountryCode.Text;
                shipperAddress.AddressLine       = addressLine;
                shipper.Address       = shipperAddress;
                shipper.Name          = textBox_Shipper_Name.Text;
                shipper.AttentionName = textBox_Shipper_AttentionName.Text;

                ShipPhoneType shipperPhone = new ShipPhoneType();
                shipperPhone.Number = textBox_Shipper_PhoneNumber.Text;
                shipper.Phone       = shipperPhone;

                // Shipment -> Shipper
                shipment.Shipper = shipper;

                // ShipFrom
                ShipFromType shipFrom = new ShipFromType();
                UPS_API.ShipWebReference.ShipAddressType shipFromAddress = new UPS_API.ShipWebReference.ShipAddressType();
                String[] shipFromAddressLine = { textBox_ShipFrom_AddressLine.Text };
                shipFromAddress.AddressLine       = addressLine;
                shipFromAddress.City              = textBox_ShipFrom_City.Text;
                shipFromAddress.PostalCode        = textBox_ShipFrom_PostalCode.Text;
                shipFromAddress.StateProvinceCode = textBox_ShipFrom_StateProvince.Text;
                shipFromAddress.CountryCode       = textBox_ShipFrom_CountryCode.Text;
                shipFrom.Address       = shipFromAddress;
                shipFrom.Name          = textBox_ShipFrom_Name.Text;
                shipFrom.AttentionName = textBox_ShipFrom_AttentionName.Text;
                ShipPhoneType shipFromPhone = new ShipPhoneType();
                shipFromPhone.Number = textBox_ShipFrom_PhoneNumber.Text;
                shipFrom.Phone       = shipFromPhone;

                // Shipment -> ShipFrom
                shipment.ShipFrom = shipFrom;

                // ShipTo
                ShipToType        shipTo        = new ShipToType();
                ShipToAddressType shipToAddress = new ShipToAddressType();
                String[]          addressLine1  = { textBox_ShipTo_AddressLine1.Text };
                shipToAddress.AddressLine       = addressLine1;
                shipToAddress.City              = textBox_ShipTo_City.Text;
                shipToAddress.PostalCode        = textBox_ShipTo_PostalCode.Text;
                shipToAddress.StateProvinceCode = textBox_ShipTo_StateProvince.Text;
                shipToAddress.CountryCode       = textBox_ShiptTo_CountryCode.Text;
                shipTo.Address       = shipToAddress;
                shipTo.Name          = textBox_ShipTo_Name.Text;
                shipTo.AttentionName = textBox_ShipTo_AttentionName.Text;
                ShipPhoneType shipToPhone = new ShipPhoneType();
                shipToPhone.Number = textBox_ShipTo_PhoneNumber.Text;
                shipTo.Phone       = shipToPhone;

                // Shipment -> ShipTo
                shipment.ShipTo = shipTo;

                // Services
                ServiceType service = new ServiceType();
                service.Code = "11";

                //ShipmentServiceOptionsType shipmentServiceOptions = new ShipmentServiceOptionsType();


                // Shipment -> Services
                shipment.Service = service;

                // Package
                PackageType       package       = new PackageType();
                PackageWeightType packageWeight = new PackageWeightType();
                packageWeight.Weight = textBox_Package_Weight.Text;
                ShipUnitOfMeasurementType uom = new ShipUnitOfMeasurementType();
                uom.Code = textBox_Package_MeasurementCode.Text;
                packageWeight.UnitOfMeasurement = uom;
                package.PackageWeight           = packageWeight;
                PackagingType packType = new PackagingType();
                packType.Code     = textBox_Package_TypeCode.Text;
                package.Packaging = packType;
                PackageType[] pkgArray = { package };

                // Shipment -> Package
                shipment.Package = pkgArray;

                // Label
                LabelSpecificationType labelSpec      = new LabelSpecificationType();
                LabelStockSizeType     labelStockSize = new LabelStockSizeType();
                labelStockSize.Height    = "6";
                labelStockSize.Width     = "4";
                labelSpec.LabelStockSize = labelStockSize;
                LabelImageFormatType labelImageFormat = new LabelImageFormatType();
                labelImageFormat.Code      = "PNG";
                labelSpec.LabelImageFormat = labelImageFormat;

                // Shipment Request -> Label
                shipmentRequest.LabelSpecification = labelSpec;

                // Shipment Request -> Shipment
                shipmentRequest.Shipment = shipment;

                // Request -> Execute
                richTextBox1.Text += shipmentRequest + "\r\n";
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11; //This line will ensure the latest security protocol for consuming the web service call.
                ShipmentResponse shipmentResponse = shipService.ProcessShipment(shipmentRequest);

                string shipmentIdentificationNumber = shipmentResponse.ShipmentResults.ShipmentIdentificationNumber;

                richTextBox1.Text += "The transaction was a " + shipmentResponse.Response.ResponseStatus.Description + "\r\n";
                richTextBox1.Text += "The 1Z number of the new shipment is " + shipmentIdentificationNumber + "\r\n";
                textBox_ShipmentIdentificationNumber.Text = shipmentIdentificationNumber;

                // Save label as PNG
                string base64Label = shipmentResponse.ShipmentResults.PackageResults[0].ShippingLabel.GraphicImage;
                byte[] data        = Convert.FromBase64String(base64Label);
                using (var stream = new MemoryStream(data, 0, data.Length))
                {
                    Image imageLabel = Image.FromStream(stream);
                    pictureBox_Label.Image = imageLabel;
                    pictureBox_Label.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    imageLabel.Save(Path.Combine(@Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "ups_" + shipmentResponse.ShipmentResults.ShipmentIdentificationNumber + ".png"));
                }

                textBox_ErrorLog.ForeColor = Color.LimeGreen;
                textBox_ErrorLog.Text      = "OK";
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                textBox_ErrorLog.ForeColor = Color.Salmon;
                textBox_ErrorLog.Text      = ex.Detail.LastChild.InnerText;

                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "---------Ship Web Service returns error----------------\r\n";
                richTextBox1.Text += "---------\"Hard\" is user error \"Transient\" is system error----------------\r\n";
                richTextBox1.Text += "SoapException Message= " + ex.Message;
                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "SoapException Category:Code:Message= " + ex.Detail.LastChild.InnerText;
                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "SoapException XML String for all= " + ex.Detail.LastChild.OuterXml;
                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "SoapException StackTrace= " + ex.StackTrace;
                richTextBox1.Text += "-------------------------\r\n";
                richTextBox1.Text += "\r\n";
            }
            catch (System.ServiceModel.CommunicationException ex)
            {
                textBox_ErrorLog.ForeColor = Color.Salmon;
                textBox_ErrorLog.Text      = ex.Message;

                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "--------------------\r\n";
                richTextBox1.Text += "CommunicationException= " + ex.Message;
                richTextBox1.Text += "CommunicationException-StackTrace= " + ex.StackTrace;
                richTextBox1.Text += "-------------------------\r\n";
                richTextBox1.Text += "\r\n";
            }
            catch (Exception ex)
            {
                textBox_ErrorLog.ForeColor = Color.Salmon;
                textBox_ErrorLog.Text      = ex.Message;

                richTextBox1.Text += "\r\n";
                richTextBox1.Text += "-------------------------\r\n";
                richTextBox1.Text += " General Exception= " + ex.Message;
                richTextBox1.Text += " General Exception-StackTrace= " + ex.StackTrace;
                richTextBox1.Text += "-------------------------\r\n";
            }
            finally
            {
            }
        }
示例#48
0
 public AccountCell(ServiceType serviceType, Action tapped) : base("", tapped)
 {
     this.style      = UIKit.UITableViewCellStyle.Subtitle;
     ServiceType     = serviceType;
     BackgroundColor = UIColor.Clear;
 }
示例#49
0
 public SRActionMessage(ActionType type, ServiceType serviceType) : base()
 {
     this.type        = type;
     this.serviceType = serviceType;
 }
示例#50
0
 public ProviderAgent(ServiceType serviceType)
 {
     _type = serviceType;
 }
示例#51
0
 public void AddIntent(ServiceType service, string intentName)
 {
     AddIntent(service, intentName, null);
 }
示例#52
0
        // Mappers between local enums and service enums
        private static CarrierCodeType GetCarrierCode(ServiceType service)
        {
            CarrierCodeType result = CarrierCodeType.FDXG;

            switch (service)
            {
            case ServiceType.EUROPEFIRSTINTERNATIONALPRIORITY:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEX1DAYFREIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEX2DAY:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEX2DAYFREIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEX3DAYFREIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEXEXPRESSSAVER:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.FEDEXGROUND:
                result = CarrierCodeType.FDXG;
                break;

            case ServiceType.FIRSTOVERNIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.GROUNDHOMEDELIVERY:
                result = CarrierCodeType.FDXG;
                break;

            case ServiceType.INTERNATIONALECONOMY:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.INTERNATIONALECONOMYFREIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.INTERNATIONALFIRST:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.INTERNATIONALPRIORITY:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.INTERNATIONALPRIORITYFREIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.PRIORITYOVERNIGHT:
                result = CarrierCodeType.FDXE;
                break;

            case ServiceType.STANDARDOVERNIGHT:
                result = CarrierCodeType.FDXE;
                break;

            default:
                result = CarrierCodeType.FDXE;
                break;
            }

            return(result);
        }
示例#53
0
 internal SourceCodeGenerator(ServiceType serviceType)
 {
     InitializeDependencies(serviceType);
 }
示例#54
0
 public List <Match> OrderBest(IEnumerable <Match> matches)
 {
     return(matches.Where(m => m.Similarity >= minSimilarity)
            .OrderBy(m => serviceValues[ServiceType.GetTypeByUrl(m.Url).Id]).ToList());
 }
示例#55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClonePermissionService" /> class.
 /// </summary>
 /// <param name="selectedNodes">selectedNodes.</param>
 /// <param name="uncheckedNodes">uncheckedNodes.</param>
 /// <param name="sourceUserRestrictionType">sourceUserRestrictionType.</param>
 /// <param name="targetUserRestrictionType">targetUserRestrictionType.</param>
 /// <param name="cloneOption">cloneOption.</param>
 /// <param name="clonePermissionAssignBy">clonePermissionAssignBy.</param>
 /// <param name="additionalCloneOption">additionalCloneOption.</param>
 /// <param name="cloneAdditionalOptionAssignBy">cloneAdditionalOptionAssignBy.</param>
 /// <param name="enabledRemoveExplicitPermission">enabledRemoveExplicitPermission.</param>
 /// <param name="enabledRemoveUserFromSPGroup">enabledRemoveUserFromSPGroup.</param>
 /// <param name="enabledDeleteUserPermission">enabledDeleteUserPermission.</param>
 /// <param name="transferOptionValueAssignBy">transferOptionValueAssignBy.</param>
 /// <param name="isHideTree">isHideTree.</param>
 /// <param name="scopeSettings">scopeSettings.</param>
 /// <param name="departmentAssignBy">departmentAssignBy.</param>
 /// <param name="metadatas">metadatas.</param>
 /// <param name="hideRequestSummary">hideRequestSummary.</param>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="type">type.</param>
 /// <param name="department">department.</param>
 /// <param name="loadDepartmentFromUps">loadDepartmentFromUps.</param>
 /// <param name="departments">departments.</param>
 /// <param name="serviceContact">serviceContact.</param>
 /// <param name="serviceAdminContact">serviceAdminContact.</param>
 /// <param name="approversContainManagerRole">approversContainManagerRole.</param>
 /// <param name="status">status.</param>
 /// <param name="showServiceInCatalog">showServiceInCatalog.</param>
 /// <param name="customActions">customActions.</param>
 /// <param name="approvalProcessId">approvalProcessId.</param>
 /// <param name="languageId">languageId.</param>
 /// <param name="categoryId">categoryId.</param>
 public ClonePermissionService(List <TreeNode> selectedNodes = default(List <TreeNode>), List <TreeNode> uncheckedNodes = default(List <TreeNode>), UserLevelRestrictionType sourceUserRestrictionType = default(UserLevelRestrictionType), UserLevelRestrictionType targetUserRestrictionType = default(UserLevelRestrictionType), ClonePermissionOption cloneOption = default(ClonePermissionOption), AssignBy clonePermissionAssignBy = default(AssignBy), ClonePermissionAdditionalOption additionalCloneOption = default(ClonePermissionAdditionalOption), AssignBy cloneAdditionalOptionAssignBy = default(AssignBy), bool enabledRemoveExplicitPermission = default(bool), bool enabledRemoveUserFromSPGroup = default(bool), bool enabledDeleteUserPermission = default(bool), AssignBy transferOptionValueAssignBy = default(AssignBy), bool isHideTree = default(bool), ServiceScopeSettings scopeSettings = default(ServiceScopeSettings), AssignBy departmentAssignBy = default(AssignBy), List <CustomMetadata> metadatas = default(List <CustomMetadata>), bool hideRequestSummary = default(bool), Guid id = default(Guid), string name = default(string), string description = default(string), ServiceType type = default(ServiceType), string department = default(string), bool loadDepartmentFromUps = default(bool), List <string> departments = default(List <string>), ApiUser serviceContact = default(ApiUser), ApiUser serviceAdminContact = default(ApiUser), bool approversContainManagerRole = default(bool), CommonStatus status = default(CommonStatus), bool showServiceInCatalog = default(bool), CustomActionSettings customActions = default(CustomActionSettings), Guid approvalProcessId = default(Guid), int languageId = default(int), string categoryId = default(string))
 {
     this.SelectedNodes             = selectedNodes;
     this.UncheckedNodes            = uncheckedNodes;
     this.SourceUserRestrictionType = sourceUserRestrictionType;
     this.TargetUserRestrictionType = targetUserRestrictionType;
     this.CloneOption                     = cloneOption;
     this.ClonePermissionAssignBy         = clonePermissionAssignBy;
     this.AdditionalCloneOption           = additionalCloneOption;
     this.CloneAdditionalOptionAssignBy   = cloneAdditionalOptionAssignBy;
     this.EnabledRemoveExplicitPermission = enabledRemoveExplicitPermission;
     this.EnabledRemoveUserFromSPGroup    = enabledRemoveUserFromSPGroup;
     this.EnabledDeleteUserPermission     = enabledDeleteUserPermission;
     this.TransferOptionValueAssignBy     = transferOptionValueAssignBy;
     this.IsHideTree         = isHideTree;
     this.ScopeSettings      = scopeSettings;
     this.DepartmentAssignBy = departmentAssignBy;
     this.Metadatas          = metadatas;
     this.HideRequestSummary = hideRequestSummary;
     this.Id                          = id;
     this.Name                        = name;
     this.Description                 = description;
     this.Type                        = type;
     this.Department                  = department;
     this.LoadDepartmentFromUps       = loadDepartmentFromUps;
     this.Departments                 = departments;
     this.ServiceContact              = serviceContact;
     this.ServiceAdminContact         = serviceAdminContact;
     this.ApproversContainManagerRole = approversContainManagerRole;
     this.Status                      = status;
     this.ShowServiceInCatalog        = showServiceInCatalog;
     this.CustomActions               = customActions;
     this.ApprovalProcessId           = approvalProcessId;
     this.LanguageId                  = languageId;
     this.CategoryId                  = categoryId;
 }
示例#56
0
			public NameEnumerator(ServiceType par) 
			{
                this.SetSamplerState(0, SamplerStateparent = par;
                this.SetSamplerState(0, SamplerStatenIndex = -1;
			}
示例#57
0
        private static MerchantTribe.Shipping.FedEx.FedExRateServices.ServiceType GetServiceType(ServiceType serviceType)
        {
            MerchantTribe.Shipping.FedEx.FedExRateServices.ServiceType result = FedExRateServices.ServiceType.FEDEX_2_DAY;

            switch (serviceType)
            {
            case ServiceType.EUROPEFIRSTINTERNATIONALPRIORITY:
                return(FedExRateServices.ServiceType.EUROPE_FIRST_INTERNATIONAL_PRIORITY);

            case ServiceType.FEDEX1DAYFREIGHT:
                return(FedExRateServices.ServiceType.FEDEX_1_DAY_FREIGHT);

            case ServiceType.FEDEX2DAY:
                return(FedExRateServices.ServiceType.FEDEX_2_DAY);

            case ServiceType.FEDEX2DAY_AM:
                return(FedExRateServices.ServiceType.FEDEX_2_DAY_AM);

            case ServiceType.FEDEX2DAYFREIGHT:
                return(FedExRateServices.ServiceType.FEDEX_2_DAY_FREIGHT);

            case ServiceType.FEDEX3DAYFREIGHT:
                return(FedExRateServices.ServiceType.FEDEX_3_DAY_FREIGHT);

            case ServiceType.FEDEXEXPRESSSAVER:
                return(FedExRateServices.ServiceType.FEDEX_EXPRESS_SAVER);

            case ServiceType.FIRSTOVERNIGHT:
                return(FedExRateServices.ServiceType.FEDEX_FIRST_FREIGHT);

            case ServiceType.FEDEXGROUND:
                return(FedExRateServices.ServiceType.FEDEX_GROUND);

            case ServiceType.GROUNDHOMEDELIVERY:
                return(FedExRateServices.ServiceType.GROUND_HOME_DELIVERY);

            case ServiceType.INTERNATIONALECONOMY:
                return(FedExRateServices.ServiceType.INTERNATIONAL_ECONOMY);

            case ServiceType.INTERNATIONALECONOMYFREIGHT:
                return(FedExRateServices.ServiceType.INTERNATIONAL_ECONOMY_FREIGHT);

            case ServiceType.INTERNATIONALFIRST:
                return(FedExRateServices.ServiceType.INTERNATIONAL_FIRST);

            case ServiceType.INTERNATIONALPRIORITY:
                return(FedExRateServices.ServiceType.INTERNATIONAL_PRIORITY);

            case ServiceType.INTERNATIONALPRIORITYFREIGHT:
                return(FedExRateServices.ServiceType.INTERNATIONAL_PRIORITY_FREIGHT);

            case ServiceType.PRIORITYOVERNIGHT:
                return(FedExRateServices.ServiceType.PRIORITY_OVERNIGHT);

            case ServiceType.STANDARDOVERNIGHT:
                return(FedExRateServices.ServiceType.STANDARD_OVERNIGHT);

            case ServiceType.SMARTPOST:
                return(FedExRateServices.ServiceType.SMART_POST);
            }

            return(result);
        }
示例#58
0
        private static decimal RateSinglePackage(FedExGlobalServiceSettings globalSettings,
                                                 MerchantTribe.Web.Logging.ILogger logger,
                                                 IShipment pak,
                                                 ServiceType service,
                                                 PackageType packaging,
                                                 CarrierCodeType carCode)
        {
            decimal result = 0m;



            try
            {
                // Auth Header Data
                var req = new FedExRateServices.RateRequest();
                req.WebAuthenticationDetail = new WebAuthenticationDetail();
                req.WebAuthenticationDetail.UserCredential          = new WebAuthenticationCredential();
                req.WebAuthenticationDetail.UserCredential.Key      = globalSettings.UserKey;
                req.WebAuthenticationDetail.UserCredential.Password = globalSettings.UserPassword;
                req.ClientDetail = new ClientDetail();
                req.ClientDetail.AccountNumber = globalSettings.AccountNumber;
                req.ClientDetail.MeterNumber   = globalSettings.MeterNumber;
                req.ClientDetail.IntegratorId  = "BVSoftware";
                req.Version = new VersionId();

                // Basic Transaction Data
                req.TransactionDetail = new TransactionDetail();
                req.TransactionDetail.CustomerTransactionId = System.Guid.NewGuid().ToString();
                req.ReturnTransitAndCommit = false;
                req.CarrierCodes           = new CarrierCodeType[1] {
                    carCode
                };

                // Shipment Details
                req.RequestedShipment = new RequestedShipment();

                req.RequestedShipment.LabelSpecification                         = new LabelSpecification();
                req.RequestedShipment.LabelSpecification.ImageType               = ShippingDocumentImageType.PDF;
                req.RequestedShipment.LabelSpecification.LabelFormatType         = LabelFormatType.COMMON2D;
                req.RequestedShipment.LabelSpecification.CustomerSpecifiedDetail = new CustomerSpecifiedLabelDetail();

                req.RequestedShipment.DropoffType       = GetDropOffType(globalSettings.DefaultDropOffType);
                req.RequestedShipment.PackagingType     = GetPackageType(packaging);
                req.RequestedShipment.TotalWeight       = new Weight();
                req.RequestedShipment.TotalWeight.Value = Math.Round(pak.Items.Sum(y => y.BoxWeight), 1);
                if (pak.Items[0].BoxWeightType == Shipping.WeightType.Kilograms)
                {
                    req.RequestedShipment.TotalWeight.Units = WeightUnits.KG;
                }
                else
                {
                    req.RequestedShipment.TotalWeight.Units = WeightUnits.LB;
                }

                // Uncomment these lines to get insured values passed in
                //
                //var totalValue = pak.Items.Sum(y => y.BoxValue);
                //req.RequestedShipment.TotalInsuredValue = new Money();
                //req.RequestedShipment.TotalInsuredValue.Amount = totalValue;
                //req.RequestedShipment.TotalInsuredValue.Currency = "USD";

                req.RequestedShipment.PackageCount = pak.Items.Count.ToString();

                req.RequestedShipment.RequestedPackageLineItems = new RequestedPackageLineItem[pak.Items.Count];
                for (int i = 0; i < pak.Items.Count; i++)
                {
                    req.RequestedShipment.RequestedPackageLineItems[i]                   = new RequestedPackageLineItem();
                    req.RequestedShipment.RequestedPackageLineItems[i].GroupNumber       = "1";
                    req.RequestedShipment.RequestedPackageLineItems[i].GroupPackageCount = (i + 1).ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight            = new Weight();
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight.Value      = pak.Items[i].BoxWeight;
                    req.RequestedShipment.RequestedPackageLineItems[i].Weight.Units      = pak.Items[i].BoxWeightType == Shipping.WeightType.Kilograms ? WeightUnits.KG : WeightUnits.LB;
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions        = new Dimensions();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Height = pak.Items[i].BoxHeight.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Length = pak.Items[i].BoxLength.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Width  = pak.Items[i].BoxWidth.ToString();
                    req.RequestedShipment.RequestedPackageLineItems[i].Dimensions.Units  = pak.Items[i].BoxLengthType == LengthType.Centimeters ? LinearUnits.CM : LinearUnits.IN;
                }

                req.RequestedShipment.Recipient                     = new Party();
                req.RequestedShipment.Recipient.Address             = new FedExRateServices.Address();
                req.RequestedShipment.Recipient.Address.City        = pak.DestinationAddress.City;
                req.RequestedShipment.Recipient.Address.CountryCode = GetCountryCode(pak.DestinationAddress.CountryData);
                req.RequestedShipment.Recipient.Address.PostalCode  = pak.DestinationAddress.PostalCode;

                if (pak.DestinationAddress.CountryData.Bvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0" || // US or Canada
                    pak.DestinationAddress.CountryData.Bvin == "94052dcf-1ac8-4b65-813b-b17b12a0491f")
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = pak.DestinationAddress.RegionData.Abbreviation; // GetStateCode(pak.DestinationAddress.RegionData);
                }
                else
                {
                    req.RequestedShipment.Recipient.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Recipient.Address.StreetLines = new string[2] {
                    pak.DestinationAddress.Street, pak.DestinationAddress.Street2
                };

                if (service == ServiceType.GROUNDHOMEDELIVERY)
                {
                    req.RequestedShipment.Recipient.Address.Residential          = true;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                }
                else if (service == ServiceType.FEDEXGROUND)
                {
                    req.RequestedShipment.Recipient.Address.Residential          = false;
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = true;
                }
                else
                {
                    req.RequestedShipment.Recipient.Address.ResidentialSpecified = false;
                }

                req.RequestedShipment.Shipper = new Party();
                req.RequestedShipment.Shipper.AccountNumber       = globalSettings.AccountNumber;
                req.RequestedShipment.Shipper.Address             = new FedExRateServices.Address();
                req.RequestedShipment.Shipper.Address.City        = pak.SourceAddress.City;
                req.RequestedShipment.Shipper.Address.CountryCode = GetCountryCode(pak.SourceAddress.CountryData);
                req.RequestedShipment.Shipper.Address.PostalCode  = pak.SourceAddress.PostalCode;
                req.RequestedShipment.Shipper.Address.Residential = false;
                if (pak.SourceAddress.CountryData.Bvin == "bf7389a2-9b21-4d33-b276-23c9c18ea0c0" || // US or Canada
                    pak.SourceAddress.CountryData.Bvin == "94052dcf-1ac8-4b65-813b-b17b12a0491f")
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = pak.SourceAddress.RegionData.Abbreviation;
                }
                else
                {
                    req.RequestedShipment.Shipper.Address.StateOrProvinceCode = string.Empty;
                }
                req.RequestedShipment.Shipper.Address.StreetLines = new string[2] {
                    pak.SourceAddress.Street, pak.SourceAddress.Street2
                };


                var       svc = new FedExRateServices.RateService();
                RateReply res = svc.getRates(req);

                if (res.HighestSeverity == NotificationSeverityType.ERROR ||
                    res.HighestSeverity == NotificationSeverityType.FAILURE)
                {
                    if (globalSettings.DiagnosticsMode == true)
                    {
                        foreach (var err in res.Notifications)
                        {
                            logger.LogMessage("FEDEX", err.Message, Web.Logging.EventLogSeverity.Debug);
                        }
                    }
                    result = 0m;
                }
                else
                {
                    result = 0m;

                    var lookingForService = GetServiceType(service);
                    var matchingResponse  = res.RateReplyDetails.Where(y => y.ServiceType == lookingForService).FirstOrDefault();
                    if (matchingResponse != null)
                    {
                        var matchedRate = matchingResponse.RatedShipmentDetails.Where(
                            y => y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_PACKAGE ||
                            y.ShipmentRateDetail.RateType == ReturnedRateType.PAYOR_ACCOUNT_SHIPMENT).FirstOrDefault();
                        if (matchedRate != null)
                        {
                            result = matchedRate.ShipmentRateDetail.TotalNetCharge.Amount;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = 0m;
                logger.LogException(ex);
            }

            return(result);
        }
示例#59
0
 public override int GetHashCode()
 {
     return(DisplayName.GetSafeHashCode() ^ Name.GetSafeHashCode() ^ ServiceType.GetHashCode() ^ UserName.GetSafeHashCode() ^ ProtectionLevel.GetHashCode());
 }
示例#60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupLifecycleService" /> class.
 /// </summary>
 /// <param name="tenantId">tenantId.</param>
 /// <param name="action">action.</param>
 /// <param name="departmentAssignBy">departmentAssignBy.</param>
 /// <param name="metadatas">metadatas.</param>
 /// <param name="hideRequestSummary">hideRequestSummary.</param>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="type">type.</param>
 /// <param name="department">department.</param>
 /// <param name="loadDepartmentFromUps">loadDepartmentFromUps.</param>
 /// <param name="departments">departments.</param>
 /// <param name="serviceContact">serviceContact.</param>
 /// <param name="serviceAdminContact">serviceAdminContact.</param>
 /// <param name="approversContainManagerRole">approversContainManagerRole.</param>
 /// <param name="status">status.</param>
 /// <param name="showServiceInCatalog">showServiceInCatalog.</param>
 /// <param name="customActions">customActions.</param>
 /// <param name="approvalProcessId">approvalProcessId.</param>
 /// <param name="languageId">languageId.</param>
 /// <param name="categoryId">categoryId.</param>
 public GroupLifecycleService(Guid tenantId = default(Guid), GroupLifecycleActionType action = default(GroupLifecycleActionType), AssignBy departmentAssignBy = default(AssignBy), List <CustomMetadata> metadatas = default(List <CustomMetadata>), bool hideRequestSummary = default(bool), Guid id = default(Guid), string name = default(string), string description = default(string), ServiceType type = default(ServiceType), string department = default(string), bool loadDepartmentFromUps = default(bool), List <string> departments = default(List <string>), ApiUser serviceContact = default(ApiUser), ApiUser serviceAdminContact = default(ApiUser), bool approversContainManagerRole = default(bool), CommonStatus status = default(CommonStatus), bool showServiceInCatalog = default(bool), CustomActionSettings customActions = default(CustomActionSettings), Guid approvalProcessId = default(Guid), int languageId = default(int), string categoryId = default(string))
 {
     this.Metadatas           = metadatas;
     this.Name                = name;
     this.Description         = description;
     this.Department          = department;
     this.Departments         = departments;
     this.ServiceContact      = serviceContact;
     this.ServiceAdminContact = serviceAdminContact;
     this.CustomActions       = customActions;
     this.CategoryId          = categoryId;
     this.TenantId            = tenantId;
     this.Action              = action;
     this.DepartmentAssignBy  = departmentAssignBy;
     this.Metadatas           = metadatas;
     this.HideRequestSummary  = hideRequestSummary;
     this.Id                          = id;
     this.Name                        = name;
     this.Description                 = description;
     this.Type                        = type;
     this.Department                  = department;
     this.LoadDepartmentFromUps       = loadDepartmentFromUps;
     this.Departments                 = departments;
     this.ServiceContact              = serviceContact;
     this.ServiceAdminContact         = serviceAdminContact;
     this.ApproversContainManagerRole = approversContainManagerRole;
     this.Status                      = status;
     this.ShowServiceInCatalog        = showServiceInCatalog;
     this.CustomActions               = customActions;
     this.ApprovalProcessId           = approvalProcessId;
     this.LanguageId                  = languageId;
     this.CategoryId                  = categoryId;
 }