本文整理汇总了C#中ServiceType类的典型用法代码示例。如果您正苦于以下问题:C# ServiceType类的具体用法?C# ServiceType怎么用?C# ServiceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceType类属于命名空间,在下文中一共展示了ServiceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveServiceType
public void SaveServiceType(ServiceType servicetypeObj)
{
using (var db = new eTempleDbDB())
{
db.Save(servicetypeObj);
}
}
示例2: UpdateServiceType
public int UpdateServiceType(ServiceType servicetypeObj)
{
using (var db = new eTempleDbDB())
{
return db.Update(servicetypeObj);
}
}
示例3: InvalidOperationException
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;
}
示例4: _GetAccountInfo
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;
}
示例5: PacketOut
public PacketOut(LogonServerOpCode opcode)
: base(new MemoryStream())
{
packetId = new PacketId(opcode);
Service = ServiceType.Logon;
this.Write((byte)opcode);
}
示例6: Request
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));
}
示例7: DoSomethingForService
/// <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;
}
示例8: DynDnsUpdater
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");
}
}
}
示例9: ClientCommandEventArgs
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;
}
示例10: CalculateEmission
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
};
}
示例11: ReportServiceDownClientReport
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);
}
示例12: ServiceAnnouncement
internal ServiceAnnouncement(UpnpClient client, ServiceType type, string deviceUdn, IEnumerable<string> locations)
{
this.client = client;
this.type = type;
this.deviceUdn = deviceUdn;
this.locations = locations;
}
示例13: WhereNot
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;
}
示例14: ActivityData
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;
}
示例15: Create
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);
}
}