public Task <Gig> CreateAsync(string title, Guid categoryId, string coverImage, string description) { var newGig = Gig.Create(GuidGenerator.Create(), categoryId, title, coverImage, description); return(_gigRepository.InsertAsync(newGig, true)); }
public VehicleWheel() { this.Id = GuidGenerator.GenerateTimeBasedGuid(); }
protected static Apparel ConvertStyle(Style style, Guid?id = null) => new Apparel { Id = id ?? GuidGenerator.GenerateTimeBasedGuid(), Face = new Component { Type = ComponentTypes.Face, Index = style[PedComponents.Face].Index, Texture = style[PedComponents.Face].TextureIndex }, Head = new Component { Type = ComponentTypes.Head, Index = style[PedComponents.Head].Index, Texture = style[PedComponents.Head].TextureIndex }, Hair = new Component { Type = ComponentTypes.Hair, Index = style[PedComponents.Hair].Index, Texture = style[PedComponents.Hair].TextureIndex }, Torso = new Component { Type = ComponentTypes.Torso, Index = style[PedComponents.Torso].Index, Texture = style[PedComponents.Torso].TextureIndex }, Legs = new Component { Type = ComponentTypes.Legs, Index = style[PedComponents.Legs].Index, Texture = style[PedComponents.Legs].TextureIndex }, Hands = new Component { Type = ComponentTypes.Hands, Index = style[PedComponents.Hands].Index, Texture = style[PedComponents.Hands].TextureIndex }, Shoes = new Component { Type = ComponentTypes.Shoes, Index = style[PedComponents.Shoes].Index, Texture = style[PedComponents.Shoes].TextureIndex }, Special1 = new Component { Type = ComponentTypes.Special1, Index = style[PedComponents.Special1].Index, Texture = style[PedComponents.Special1].TextureIndex }, Special2 = new Component { Type = ComponentTypes.Special2, Index = style[PedComponents.Special2].Index, Texture = style[PedComponents.Special2].TextureIndex }, Special3 = new Component { Type = ComponentTypes.Special3, Index = style[PedComponents.Special3].Index, Texture = style[PedComponents.Special3].TextureIndex }, Textures = new Component { Type = ComponentTypes.Textures, Index = style[PedComponents.Textures].Index, Texture = style[PedComponents.Textures].TextureIndex }, Torso2 = new Component { Type = ComponentTypes.Torso2, Index = style[PedComponents.Torso2].Index, Texture = style[PedComponents.Torso2].TextureIndex }, Hat = new Prop { Type = PropTypes.Hats, Index = style[PedProps.Hats].Index, Texture = style[PedProps.Hats].TextureIndex }, Glasses = new Prop { Type = PropTypes.Glasses, Index = style[PedProps.Glasses].Index, Texture = style[PedProps.Glasses].TextureIndex }, EarPiece = new Prop { Type = PropTypes.EarPieces, Index = style[PedProps.EarPieces].Index, Texture = style[PedProps.EarPieces].TextureIndex }, Unknown3 = new Prop { Type = PropTypes.Unknown3, Index = style[PedProps.Unknown3].Index, Texture = style[PedProps.Unknown3].TextureIndex }, Unknown4 = new Prop { Type = PropTypes.Unknown4, Index = style[PedProps.Unknown4].Index, Texture = style[PedProps.Unknown4].TextureIndex }, Unknown5 = new Prop { Type = PropTypes.Unknown5, Index = style[PedProps.Unknown5].Index, Texture = style[PedProps.Unknown5].TextureIndex }, Watch = new Prop { Type = PropTypes.Watches, Index = style[PedProps.Watches].Index, Texture = style[PedProps.Watches].TextureIndex }, Wristband = new Prop { Type = PropTypes.Wristbands, Index = style[PedProps.Wristbands].Index, Texture = style[PedProps.Wristbands].TextureIndex }, Unknown8 = new Prop { Type = PropTypes.Unknown8, Index = style[PedProps.Unknown8].Index, Texture = style[PedProps.Unknown8].TextureIndex }, Unknown9 = new Prop { Type = PropTypes.Unknown9, Index = style[PedProps.Unknown9].Index, Texture = style[PedProps.Unknown9].TextureIndex } };
public _ITaskbarManagerStatics() { _obj = (new BaseActivationFactory("Windows.UI.Shell", "Windows.UI.Shell.TaskbarManager"))._As(GuidGenerator.GetIID(typeof(Windows.UI.Shell.ITaskbarManagerStatics).GetHelperType())); }
public static Wallet GetNewWallet() { return(new Wallet(GuidGenerator.GenerateID())); }
protected List <FileCrawlerRecord> CreateFileCrawlerRecordList(FileCrawler fileCrawler, DateTime date, ParameterCombination parameterCombination) { List <FileCrawlerRecord> list = new List <FileCrawlerRecord>(); Dictionary <string, object> dic = JsonSerializer.Deserialize <Dictionary <string, object> >(parameterCombination.Parameters); List <FileCrawlerPeriod> periods = JsonSerializer.Deserialize <List <FileCrawlerPeriod> >(parameterCombination.Periods); if (fileCrawler.Type == FileCrawlerType.Archive) { foreach (FileCrawlerPeriod period in periods) { Func <DateTime, int, DateTime> getTimeFunc = GetGetTimeFunc(period.Type); Func <TimeSpan, int> getOffsetFunc = GetGetOffsetFunc(period.Type); for (int i = period.Start; i <= period.End; i += period.Interval) { DateTime sourceTime = getTimeFunc(date, i); dic["SourceTime"] = sourceTime; dic["SourceTimeSpan"] = sourceTime - date; dic["SourceTimeOffset"] = i; object[] args = dic.Values.ToArray(); object[] urlArgs; if (fileCrawler.UrlDateTimeKind == DateTimeKind.Utc) { DateTime sourceTimeUtc = sourceTime.ToUniversalTime(); dic["SourceTime"] = sourceTimeUtc; dic["SourceTimeSpan"] = sourceTimeUtc - sourceTimeUtc.Date; dic["SourceTimeOffset"] = getOffsetFunc(sourceTimeUtc - sourceTimeUtc.Date); urlArgs = dic.Values.ToArray(); } else { urlArgs = args; } FileCrawlerRecord record = new FileCrawlerRecord(GuidGenerator.Create(), parameterCombination.Id, sourceTime, sourceTime) { Url = string.Format(fileCrawler.UrlFormat, urlArgs), DirectoryName = string.Format("{0}\\{1:yyyyMMdd}", Configuration["Settings:Crawlers.Files.RootDirectory"], sourceTime), FileName = string.Format(fileCrawler.FileNameFormat, args), Stamp = string.Format(fileCrawler.StampFormat, args) }; list.Add(record); } } } else { int sourceTimeOffset = int.Parse(dic["TimeOffset"] as string); DateTime sourceTime = date.AddHours(sourceTimeOffset); dic["SourceTime"] = sourceTime; dic["SourceTimeSpan"] = sourceTime - date; dic["SourceTimeOffset"] = sourceTimeOffset; foreach (FileCrawlerPeriod period in periods) { Func <DateTime, int, DateTime> getTimeFunc = GetGetTimeFunc(period.Type); for (int i = period.Start; i <= period.End; i += period.Interval) { DateTime targetTime = getTimeFunc(sourceTime, i); dic["TargetTime"] = targetTime; dic["TargetTimeSpan"] = targetTime - sourceTime; dic["TargetTimeOffset"] = i; object[] args = dic.Values.ToArray(); object[] urlArgs; if (fileCrawler.UrlDateTimeKind == DateTimeKind.Utc) { DateTime sourceTimeUtc = sourceTime.ToUniversalTime(); DateTime targetTimeUtc = targetTime.ToUniversalTime(); dic["SourceTime"] = sourceTimeUtc; dic["SourceTimeSpan"] = sourceTimeUtc - sourceTimeUtc.Date; dic["SourceTimeOffset"] = (sourceTimeUtc - sourceTimeUtc.Date).Hours; dic["TargetTime"] = targetTimeUtc; urlArgs = dic.Values.ToArray(); } else { urlArgs = args; } FileCrawlerRecord record = new FileCrawlerRecord(GuidGenerator.Create(), parameterCombination.Id, sourceTime, targetTime) { Url = string.Format(fileCrawler.UrlFormat, urlArgs), DirectoryName = string.Format("{0}\\{1:yyyyMMdd}", Configuration["Settings:Crawlers.Files.RootDirectory"], sourceTime), FileName = string.Format(fileCrawler.FileNameFormat, args), Stamp = string.Format(fileCrawler.StampFormat, args) }; list.Add(record); } } } return(list); }
public _IPlatformTelemetryClientStatics() { _obj = (new BaseActivationFactory("Windows.System.Diagnostics.Telemetry", "Windows.System.Diagnostics.Telemetry.PlatformTelemetryClient"))._As(GuidGenerator.GetIID(typeof(Windows.System.Diagnostics.Telemetry.IPlatformTelemetryClientStatics).GetHelperType())); }
public virtual async Task <Document> GetDocumentAsync(Project project, string documentName, string languageCode, string version, DateTime?lastKnownSignificantUpdateTime = null) { var token = project.GetGitHubAccessTokenOrNull(); var rootUrl = project.GetGitHubUrl(version); var userAgent = project.GetGithubUserAgentOrNull(); var rawRootUrl = CalculateRawRootUrlWithLanguageCode(rootUrl, languageCode); var rawDocumentUrl = rawRootUrl + documentName; var isNavigationDocument = documentName == project.NavigationDocumentName; var isParameterDocument = documentName == project.ParametersDocumentName; var editLink = rootUrl.ReplaceFirst("/tree/", "/blob/") + languageCode + "/" + documentName; var localDirectory = ""; var fileName = documentName; if (documentName.Contains("/")) { localDirectory = documentName.Substring(0, documentName.LastIndexOf('/')); fileName = documentName.Substring(documentName.LastIndexOf('/') + 1); } var content = await DownloadWebContentAsStringAsync(rawDocumentUrl, token, userAgent); var commits = await GetGitHubCommitsOrNull(project, documentName, languageCode, version); var documentCreationTime = GetFirstCommitDate(commits); var lastUpdateTime = GetLastCommitDate(commits); var lastSignificantUpdateTime = await GetLastKnownSignificantUpdateTime(project, documentName, languageCode, version, lastKnownSignificantUpdateTime, isNavigationDocument, isParameterDocument, commits, documentCreationTime); var document = new Document ( GuidGenerator.Create(), project.Id, documentName, version, languageCode, fileName, content, project.Format, editLink, rootUrl, rawRootUrl, localDirectory, documentCreationTime, lastUpdateTime, DateTime.Now, lastSignificantUpdateTime ); if (isNavigationDocument || isParameterDocument) { return(document); } var authors = GetAuthors(commits); foreach (var author in authors) { document.AddContributor(author.Login, author.HtmlUrl, author.AvatarUrl); } return(document); }
public FieldManager(int mapId) { MapId = mapId; BoundingBox = MapEntityStorage.GetBoundingBox(mapId); // Load default npcs for map from config foreach (MapNpc npc in MapEntityStorage.GetNpcs(mapId)) { IFieldObject <Npc> fieldNpc = RequestFieldObject(new Npc(npc.Id) { ZRotation = (short)(npc.Rotation.Z * 10) }); if (fieldNpc.Value.Friendly == 2) { fieldNpc.Coord = npc.Coord.ToFloat(); AddNpc(fieldNpc); } else { // NPC is an enemy IFieldObject <Mob> fieldMob = RequestFieldObject(new Mob(npc.Id) { ZRotation = (short)(npc.Rotation.Z * 10) }); fieldMob.Coord = npc.Coord.ToFloat(); AddMob(fieldMob); } } // Spawn map's mobs at the mob spawners foreach (MapMobSpawn mobSpawn in MapEntityStorage.GetMobSpawns(mapId)) { if (mobSpawn.SpawnData == null) { Debug.WriteLine($"Missing mob spawn data: {mobSpawn}"); continue; } IFieldObject <MobSpawn> fieldMobSpawn = RequestFieldObject(new MobSpawn(mobSpawn)); fieldMobSpawn.Coord = mobSpawn.Coord.ToFloat(); State.AddMobSpawn(fieldMobSpawn); SpawnMobs(fieldMobSpawn); } // Load default portals for map from config foreach (MapPortal portal in MapEntityStorage.GetPortals(mapId)) { IFieldObject <Portal> fieldPortal = RequestFieldObject(new Portal(portal.Id) { IsVisible = portal.Flags.HasFlag(MapPortalFlag.Visible), IsEnabled = portal.Flags.HasFlag(MapPortalFlag.Enabled), IsMinimapVisible = portal.Flags.HasFlag(MapPortalFlag.MinimapVisible), Rotation = portal.Rotation.ToFloat(), TargetMapId = portal.Target, }); fieldPortal.Coord = portal.Coord.ToFloat(); AddPortal(fieldPortal); } // Load default InteractObjects List <IFieldObject <InteractObject> > actors = new List <IFieldObject <InteractObject> > { }; foreach (MapInteractObject interactObject in MapEntityStorage.GetInteractObject(mapId)) { // TODO: Group these fieldActors by their correct packet type. actors.Add(RequestFieldObject(new InteractObject(interactObject.Uuid, interactObject.Name, interactObject.Type) { })); } AddInteractObject(actors); string xBlockName = MapMetadataStorage.GetMetadata(mapId).XBlockName; Triggers = TriggerLoader.GetTriggers(xBlockName).Select(initializer => { TriggerContext context = new TriggerContext(this, Logger); TriggerState startState = initializer.Invoke(context); return(new TriggerScript(context, startState)); }).ToArray(); if (MapEntityStorage.HasHealingSpot(MapId)) { List <CoordS> healingSpots = MapEntityStorage.GetHealingSpot(MapId); if (State.HealingSpots.IsEmpty) { foreach (CoordS coord in healingSpots) { int objectId = GuidGenerator.Int(); State.AddHealingSpot(RequestFieldObject(new HealingSpot(objectId, coord))); } } } }
/// <summary> /// Initializes a new instance of the <see cref="IdentityModel" /> class. /// </summary> protected IdentityModel() { this.Id = GuidGenerator.GenerateTimeBasedGuid(); this.Created = DateTime.UtcNow; }
public Bank() { this.Id = GuidGenerator.GenerateTimeBasedGuid(); this.Name = string.Empty; this.Created = DateTime.UtcNow; }
public async Task <Unit> Handle(RequestPasswordResetRequest request, CancellationToken cancellationToken) { var client = await _loginContext.Clients.SingleOrDefaultAsync(c => c.Id == request.ClientId, cancellationToken); var loginUser = await _userService.FindByEmail(request.Email); if (loginUser == null) { _loginContext.UserLogs.Add(new UserLog() { Id = GuidGenerator.NewGuid(), Action = "Request reset password link", Email = request.Email, DateTime = SystemTime.UtcNow(), Result = "Sent no account email" }); await _loginContext.SaveChangesAsync(cancellationToken); await _emailService.SendResetNoAccountPassword(new PasswordResetNoAccountEmailViewModel() { EmailAddress = request.Email, LoginLink = client.ServiceDetails.PostPasswordResetReturnUrl, Subject = "Password request received", TemplateId = client.ServiceDetails.EmailTemplates.Single(t => t.Name == "PasswordResetNoAccount").TemplateId, ServiceName = client.ServiceDetails.ServiceName, ServiceTeam = client.ServiceDetails.ServiceTeam }); return(Unit.Value); } await ClearOutAnyPreviousStillValidRequests(request.Email); var identityToken = await _userService.GeneratePasswordResetToken(loginUser); var resetPasswordRequest = await SavePasswordRequest(request, cancellationToken, identityToken); var resetUri = new Uri(new Uri(_loginConfig.BaseUrl), $"NewPassword/{request.ClientId}/{resetPasswordRequest.Id}"); await _emailService.SendResetPassword(new ResetPasswordEmailViewModel() { Contact = loginUser.GivenName, EmailAddress = request.Email, LoginLink = resetUri.ToString(), ServiceName = client.ServiceDetails.ServiceName, ServiceTeam = client.ServiceDetails.ServiceTeam, Subject = "Password reset", TemplateId = client.ServiceDetails.EmailTemplates.Single(t => t.Name == "PasswordReset").TemplateId }); _loginContext.UserLogs.Add(new UserLog() { Id = GuidGenerator.NewGuid(), Action = "Request reset password link", Email = request.Email, DateTime = SystemTime.UtcNow(), Result = "Sent reset password email" }); await _loginContext.SaveChangesAsync(cancellationToken); return(Unit.Value); }
public async Task Create(CreateUpdateClassDto input) { var book = new Class(GuidGenerator.Create(), input.Name); await _classRepository.InsertAsync(book); }
protected virtual async Task UpdateProductAttributesAsync(Product product, CreateUpdateProductDto input) { var isProductSkusEmpty = product.ProductSkus.IsNullOrEmpty(); var usedAttributeOptionIds = new HashSet <Guid>(); foreach (var serializedAttributeOptionIds in product.ProductSkus.Select(sku => sku.SerializedAttributeOptionIds)) { foreach (var attributeOptionId in await _attributeOptionIdsSerializer.DeserializeAsync( serializedAttributeOptionIds)) { usedAttributeOptionIds.Add(attributeOptionId); } } foreach (var attributeDto in input.ProductAttributes) { var attribute = product.ProductAttributes.FirstOrDefault(a => a.DisplayName == attributeDto.DisplayName); if (attribute == null) { if (!isProductSkusEmpty) { throw new ProductAttributesModificationFailedException(); } attribute = new ProductAttribute(GuidGenerator.Create(), attributeDto.DisplayName, attributeDto.Description, attributeDto.DisplayOrder); product.ProductAttributes.Add(attribute); } foreach (var optionDto in attributeDto.ProductAttributeOptions) { var option = attribute.ProductAttributeOptions.FirstOrDefault(o => o.DisplayName == optionDto.DisplayName); if (option == null) { option = new ProductAttributeOption(GuidGenerator.Create(), optionDto.DisplayName, optionDto.Description, optionDto.DisplayOrder); attribute.ProductAttributeOptions.Add(option); } } var removedOptionNames = attribute.ProductAttributeOptions.Select(o => o.DisplayName) .Except(attributeDto.ProductAttributeOptions.Select(o => o.DisplayName)).ToList(); if (!isProductSkusEmpty && removedOptionNames.Any() && usedAttributeOptionIds .Intersect(attribute.ProductAttributeOptions .Where(option => removedOptionNames.Contains(option.DisplayName)) .Select(option => option.Id)).Any()) { throw new ProductAttributeOptionsDeletionFailedException(); } attribute.ProductAttributeOptions.RemoveAll(o => removedOptionNames.Contains(o.DisplayName)); } var removedAttributeNames = product.ProductAttributes.Select(a => a.DisplayName) .Except(input.ProductAttributes.Select(a => a.DisplayName)).ToList(); if (!isProductSkusEmpty && removedAttributeNames.Any()) { throw new ProductAttributesModificationFailedException(); } product.ProductAttributes.RemoveAll(a => removedAttributeNames.Contains(a.DisplayName)); }
/// <summary> /// 生成个性艺术签名 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <ServiceResult <string> > GenerateSignatureAsync(GenerateSignatureInput input) { var result = new ServiceResult <string>(); var ip = _httpContextAccessor.HttpContext.Request.GetClientIp(); // TODO:当前ip是否在小黑屋,禁止使用 // 验签,请求是否合法 var sign = $"{input.Name}_{input.Id}_{input.Timestamp}".EncodeMd5String().ToLower(); if (input.Sign != sign) { result.IsFailed("验签不正确"); return(result); } return(await _signatureCacheService.GenerateSignatureAsync(input, async() => { // 签名类型 var type = typeof(SignatureEnum).TryToList().FirstOrDefault(x => x.Value.Equals(input.Id))?.Description; if (string.IsNullOrEmpty(type)) { result.IsFailed("签名类型不存在"); return result; } // 查询是否存在此签名,存在则直接返回 var signature = await _signatureRepository.FindAsync(x => x.Name.Equals(input.Name) && x.Type.Equals(type)); if (signature.IsNotNull()) { result.IsSuccess(signature.Url); return result; } // 签名图片名称 var signaturePicName = $"{sign}.png"; // 在配置文件中随机取一条签名api var signatureUrl = AppSettings.Signature.Urls.OrderBy(x => GuidGenerator.Create()).Select(x => new { Url = x.Key, Parameter = x.Value.FormatWith(input.Name, input.Id) }).FirstOrDefault(); // 发送请求,获取结果 var content = new StringContent(signatureUrl.Parameter); content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); using var client = _httpClient.CreateClient(); client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.14 Safari/537.36 Edg/83.0.478.13"); var httpResponse = await client.PostAsync(signatureUrl.Url, content); var httpResult = await httpResponse.Content.ReadAsStringAsync(); // 正则获取api返回的签名图片 var regex = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase); var imgUrl = regex.Match(httpResult).Groups["imgUrl"].Value; // 签名保存的路径 var signaturePath = Path.Combine(AppSettings.Signature.Path, signaturePicName); // 保存图片至本地 var imgBuffer = await client.GetByteArrayAsync(imgUrl); await imgBuffer.DownloadAsync(signaturePath); // 添加水印 await signaturePath.AddWatermarkAndSaveItAsync(); // 保存调用记录 var entity = new Domain.Signature.Signature { Name = input.Name, Type = type, Url = signaturePicName, Ip = ip, CreateTime = DateTime.Now }; await _signatureRepository.InsertAsync(entity); result.IsSuccess(entity.Url); return result; }));
private static void GenerateGuid() { _userId = GuidGenerator.NewSequentialGuid(); _credentialId = GuidGenerator.NewSequentialGuid(); }
public _IDataProtectionProviderFactory() { _obj = ActivationFactory <DataProtectionProvider> .As(GuidGenerator.GetIID(typeof(Windows.Security.Cryptography.DataProtection.IDataProtectionProviderFactory).GetHelperType())); }
public ParkOrder Add(ParkOrder model, DbOperator dbOperator) { model.DataStatus = DataStatus.Normal; model.LastUpdateTime = DateTime.Now; model.HaveUpdate = SystemDefaultConfig.DataUpdateFlag; model.RecordID = GuidGenerator.GetGuidString(); StringBuilder strSql = new StringBuilder(); strSql.Append(@"insert into ParkOrder(RecordID,Amount,CarderateID,CashMoney,CashTime,DataStatus,DiscountAmount,HaveUpdate,LastUpdateTime,NewMoney,NewUsefulDate, NewUserBegin,OldMoney,OldUserBegin,OldUserulDate,OnlineOrderNo,OnlineUserID,OrderNo,OrderSource,OrderTime,OrderType,PayAmount, PayTime,PayWay,PKID,Remark,Status,TagID,UnPayAmount,UserID,FeeRuleID) "); strSql.Append(@" values(@RecordID,@Amount,@CarderateID,@CashMoney,@CashTime,@DataStatus,@DiscountAmount,@HaveUpdate,@LastUpdateTime,@NewMoney,@NewUsefulDate, @NewUserBegin,@OldMoney,@OldUserBegin,@OldUserulDate,@OnlineOrderNo,@OnlineUserID,@OrderNo,@OrderSource,@OrderTime,@OrderType,@PayAmount, @PayTime,@PayWay,@PKID,@Remark,@Status,@TagID,@UnPayAmount,@UserID,@FeeRuleID);"); strSql.Append(" select * from ParkOrder where RecordID=@RecordID "); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", model.RecordID); dbOperator.AddParameter("Amount", model.Amount); dbOperator.AddParameter("CarderateID", model.CarderateID); dbOperator.AddParameter("CashMoney", model.CashMoney); dbOperator.AddParameter("DataStatus", (int)model.DataStatus); dbOperator.AddParameter("DiscountAmount", model.DiscountAmount); dbOperator.AddParameter("HaveUpdate", model.HaveUpdate); dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime); dbOperator.AddParameter("NewMoney", model.NewMoney); if (model.CashTime == null) { dbOperator.AddParameter("CashTime", DBNull.Value); } else { dbOperator.AddParameter("CashTime", model.CashTime); } if (model.NewUsefulDate == null) { dbOperator.AddParameter("NewUsefulDate", DBNull.Value); } else { dbOperator.AddParameter("NewUsefulDate", model.NewUsefulDate); } if (model.OldUserulDate == null) { dbOperator.AddParameter("OldUserulDate", DBNull.Value); } else { dbOperator.AddParameter("OldUserulDate", model.OldUserulDate); } if (model.OldUserBegin == null) { dbOperator.AddParameter("OldUserBegin", DBNull.Value); } else { dbOperator.AddParameter("OldUserBegin", model.OldUserBegin); } if (model.NewUserBegin == null) { dbOperator.AddParameter("NewUserBegin", DBNull.Value); } else { dbOperator.AddParameter("NewUserBegin", model.NewUserBegin); } dbOperator.AddParameter("OldMoney", model.OldMoney); dbOperator.AddParameter("OnlineOrderNo", model.OnlineOrderNo); dbOperator.AddParameter("OnlineUserID", model.OnlineUserID); dbOperator.AddParameter("OrderNo", model.OrderNo); dbOperator.AddParameter("OrderSource", model.OrderSource); dbOperator.AddParameter("OrderTime", model.OrderTime); dbOperator.AddParameter("OrderType", model.OrderType); dbOperator.AddParameter("PayAmount", model.PayAmount); dbOperator.AddParameter("PayTime", model.PayTime); dbOperator.AddParameter("PayWay", model.PayWay); dbOperator.AddParameter("PKID", model.PKID); dbOperator.AddParameter("FeeRuleID", model.FeeRuleID); dbOperator.AddParameter("Remark", model.Remark); dbOperator.AddParameter("Status", model.Status); dbOperator.AddParameter("TagID", model.TagID); dbOperator.AddParameter("UnPayAmount", model.UnPayAmount); dbOperator.AddParameter("UserID", model.UserID); using (DbDataReader reader = dbOperator.ExecuteReader(strSql.ToString())) { if (reader.Read()) { return(DataReaderToModel <ParkOrder> .ToModel(reader)); } return(null); } }
public void TestIdsGeneration() { ShadowObject.Enable = true; CollectionItemIdentifiers ids; var obj1 = new ContainerCollection("Root") { Strings = { "aaa", "bbb", "ccc" }, Objects = { new ContainerCollection("obj1"), new ContainerCollection("obj2") } }; var hashSet = new HashSet <ItemId>(); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Strings, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Strings, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Objects, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Objects, out ids)); AssetCollectionItemIdHelper.GenerateMissingItemIds(obj1); Assert.True(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Strings, out ids)); Assert.Equal(3, ids.KeyCount); Assert.Equal(0, ids.DeletedCount); Assert.True(ids.ContainsKey(0)); Assert.True(ids.ContainsKey(1)); Assert.True(ids.ContainsKey(2)); hashSet.Add(ids[0]); hashSet.Add(ids[1]); hashSet.Add(ids[2]); Assert.True(CollectionItemIdHelper.TryGetCollectionItemIds(obj1.Objects, out ids)); Assert.Equal(2, ids.KeyCount); Assert.Equal(0, ids.DeletedCount); Assert.True(ids.ContainsKey(0)); Assert.True(ids.ContainsKey(1)); hashSet.Add(ids[0]); hashSet.Add(ids[1]); Assert.Equal(5, hashSet.Count); var obj2 = new ContainerDictionary("Root") { Strings = { { GuidGenerator.Get(200), "aaa" }, { GuidGenerator.Get(100), "bbb" }, { GuidGenerator.Get(300), "ccc" } }, Objects = { { "key3", new ContainerCollection("obj1") }, { "key4", new ContainerCollection("obj2") } }, }; hashSet.Clear(); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Strings, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Strings, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Objects, out ids)); Assert.False(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Objects, out ids)); AssetCollectionItemIdHelper.GenerateMissingItemIds(obj2); Assert.True(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Strings, out ids)); Assert.Equal(3, ids.KeyCount); Assert.Equal(0, ids.DeletedCount); Assert.True(ids.ContainsKey(GuidGenerator.Get(200))); Assert.True(ids.ContainsKey(GuidGenerator.Get(100))); Assert.True(ids.ContainsKey(GuidGenerator.Get(300))); hashSet.Add(ids[GuidGenerator.Get(200)]); hashSet.Add(ids[GuidGenerator.Get(100)]); hashSet.Add(ids[GuidGenerator.Get(300)]); Assert.True(CollectionItemIdHelper.TryGetCollectionItemIds(obj2.Objects, out ids)); Assert.Equal(2, ids.KeyCount); Assert.Equal(0, ids.DeletedCount); Assert.True(ids.ContainsKey("key3")); Assert.True(ids.ContainsKey("key4")); hashSet.Add(ids["key3"]); hashSet.Add(ids["key4"]); Assert.Equal(5, hashSet.Count); }
public _IHolographicKeyboardPlacementOverridePreviewStatics() { _obj = (new BaseActivationFactory("Windows.ApplicationModel.Preview.Holographic", "Windows.ApplicationModel.Preview.Holographic.HolographicKeyboardPlacementOverridePreview"))._As(GuidGenerator.GetIID(typeof(Windows.ApplicationModel.Preview.Holographic.IHolographicKeyboardPlacementOverridePreviewStatics).GetHelperType())); }
public virtual async Task <ClientDto> CloneAsync(Guid id, ClientCloneDto input) { var clientIdExists = await ClientRepository.CheckClientIdExistAsync(input.ClientId); if (clientIdExists) { throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientIdExisted, input.ClientId]); } var srcClient = await ClientRepository.GetAsync(id); var client = new Client(GuidGenerator.Create(), input.ClientId) { ClientName = input.ClientName, Description = input.Description, AbsoluteRefreshTokenLifetime = srcClient.AbsoluteRefreshTokenLifetime, AccessTokenLifetime = srcClient.AccessTokenLifetime, AccessTokenType = srcClient.AccessTokenType, AllowAccessTokensViaBrowser = srcClient.AllowAccessTokensViaBrowser, AllowOfflineAccess = srcClient.AllowOfflineAccess, AllowPlainTextPkce = srcClient.AllowPlainTextPkce, AllowRememberConsent = srcClient.AllowRememberConsent, AlwaysIncludeUserClaimsInIdToken = srcClient.AlwaysIncludeUserClaimsInIdToken, AlwaysSendClientClaims = srcClient.AlwaysSendClientClaims, AuthorizationCodeLifetime = srcClient.AuthorizationCodeLifetime, BackChannelLogoutSessionRequired = srcClient.BackChannelLogoutSessionRequired, BackChannelLogoutUri = srcClient.BackChannelLogoutUri, ClientClaimsPrefix = srcClient.ClientClaimsPrefix, ConsentLifetime = srcClient.ConsentLifetime, DeviceCodeLifetime = srcClient.DeviceCodeLifetime, Enabled = srcClient.Enabled, EnableLocalLogin = srcClient.EnableLocalLogin, FrontChannelLogoutSessionRequired = srcClient.FrontChannelLogoutSessionRequired, FrontChannelLogoutUri = srcClient.FrontChannelLogoutUri, IdentityTokenLifetime = srcClient.IdentityTokenLifetime, IncludeJwtId = srcClient.IncludeJwtId, LogoUri = srcClient.LogoUri, PairWiseSubjectSalt = srcClient.PairWiseSubjectSalt, ProtocolType = srcClient.ProtocolType, RefreshTokenExpiration = srcClient.RefreshTokenExpiration, RefreshTokenUsage = srcClient.RefreshTokenUsage, RequireClientSecret = srcClient.RequireClientSecret, RequireConsent = srcClient.RequireConsent, RequirePkce = srcClient.RequirePkce, SlidingRefreshTokenLifetime = srcClient.SlidingRefreshTokenLifetime, UpdateAccessTokenClaimsOnRefresh = srcClient.UpdateAccessTokenClaimsOnRefresh, UserCodeType = srcClient.UserCodeType, UserSsoLifetime = srcClient.UserSsoLifetime }; if (input.CopyAllowedCorsOrigin) { foreach (var corsOrigin in srcClient.AllowedCorsOrigins) { client.AddCorsOrigin(corsOrigin.Origin); } } if (input.CopyAllowedGrantType) { foreach (var grantType in srcClient.AllowedGrantTypes) { client.AddGrantType(grantType.GrantType); } } if (input.CopyAllowedScope) { foreach (var scope in srcClient.AllowedScopes) { client.AddScope(scope.Scope); } } if (input.CopyClaim) { foreach (var claim in srcClient.Claims) { client.AddClaim(claim.Value, claim.Type); } } if (input.CopySecret) { foreach (var secret in srcClient.ClientSecrets) { client.AddSecret(secret.Value, secret.Expiration, secret.Type, secret.Description); } } if (input.CopyIdentityProviderRestriction) { foreach (var provider in srcClient.IdentityProviderRestrictions) { client.AddIdentityProviderRestriction(provider.Provider); } } if (input.CopyPostLogoutRedirectUri) { foreach (var uri in srcClient.PostLogoutRedirectUris) { client.AddPostLogoutRedirectUri(uri.PostLogoutRedirectUri); } } if (input.CopyPropertie) { foreach (var property in srcClient.Properties) { client.AddProperty(property.Key, property.Value); } } if (input.CopyRedirectUri) { foreach (var uri in srcClient.RedirectUris) { client.AddRedirectUri(uri.RedirectUri); } } client = await ClientRepository.InsertAsync(client); await CurrentUnitOfWork.SaveChangesAsync(); return(ObjectMapper.Map <Client, ClientDto>(client)); }
public virtual async Task <Blog> CreateAsync([NotNull] string name, [NotNull] string slug) { await CheckSlugAsync(slug); return(new Blog(GuidGenerator.Create(), name, slug, CurrentTenant.Id)); }
public static unsafe IObjectReference CreateMarshaler(global::System.ComponentModel.PropertyChangedEventHandler managedDelegate) => managedDelegate is null ? null : ComWrappersSupport.CreateCCWForObject(managedDelegate).As <global::WinRT.Interop.IDelegateVftbl>(GuidGenerator.GetIID(typeof(PropertyChangedEventHandler)));
internal static void SetGuidGenerator(GuidGenerator generator) { guidGenerator = generator; }
public static IObjectReference CreateMarshaler(global::System.Collections.Generic.IReadOnlyList <T> obj) => obj is null ? null : ComWrappersSupport.CreateCCWForObject(obj).As <Vftbl>(GuidGenerator.GetIID(typeof(IReadOnlyList <T>)));
public _IAdaptiveCardBuilderStatics() { _obj = (new BaseActivationFactory("Windows.UI.Shell", "Windows.UI.Shell.AdaptiveCardBuilder"))._As(GuidGenerator.GetIID(typeof(Windows.UI.Shell.IAdaptiveCardBuilderStatics).GetHelperType())); }
public static string GetGuidSignature() => GuidGenerator.GetSignature(typeof(IReadOnlyList <T>));
public GuidsWithZeroDigitsFinder(GuidGenerator guidGenerator, int digitsCount, int desiredResultAmount) { _guidGenerator = guidGenerator; _digitsCount = digitsCount; _desiredResultAmount = desiredResultAmount; }
internal static bool AddCompanyDefaultUserCS(BaseCompany company, BaseVillage village, DbOperator dbOperator, string systemmodelpath) { ISysUser factory = SysUserFactory.GetFactory(); if (factory.QuerySysUserByUserAccount(company.UserAccount) != null) { throw new MyException("用户名已存在"); } SysUser user = GetDefaultUserModel(company.CPID, company.UserAccount, company.UserPassword); bool result = factory.Add(user, dbOperator); if (!result) { throw new MyException("添加用户失败"); } //添加默认角色 SysRoles role = GetDefaultSysRolesModel(company.CPID); ISysRoles roleFactory = SysRolesFactory.GetFactory(); result = roleFactory.AddSysRole(role, dbOperator); if (!result) { throw new MyException("添加单位默认角色失败"); } //添加收费员角色 SysRoles role2 = GetDefaultBaRolesModel(company.CPID); ISysRoles roleFactory2 = SysRolesFactory.GetFactory(); result = roleFactory2.AddSysRole(role2, dbOperator); if (!result) { throw new MyException("添加单位收费角色失败"); } //添加默认角色模块授权失败 List <SysRoleAuthorize> roleAuthorizes2 = GetCompanyDefaultSFYRoleAuthorizeCS(role2.RecordID, systemmodelpath); ISysRoleAuthorize roleAuthorizesFactory2 = SysRoleAuthorizeFactory.GetFactory(); result = roleAuthorizesFactory2.Add(roleAuthorizes2, dbOperator); if (!result) { throw new MyException("添加单位收费角色失败"); } //添加默认角色模块授权失败 List <SysRoleAuthorize> roleAuthorizes = GetCompanyDefaultSysRoleAuthorizeCS(role.RecordID, systemmodelpath); ISysRoleAuthorize roleAuthorizesFactory = SysRoleAuthorizeFactory.GetFactory(); result = roleAuthorizesFactory.Add(roleAuthorizes, dbOperator); if (!result) { throw new MyException("添加单位默认角色失败"); } //添加作用域 SysScope scope = GetSystemDefaultSysScope(company.CPID); ISysScope scopeFactory = SysScopeFactory.GetFactory(); result = scopeFactory.Add(scope, dbOperator); if (!result) { throw new MyException("添加系统默认作用域失败"); } SysScopeAuthorize model = new SysScopeAuthorize(); model.ASID = scope.ASID; model.ASType = ASType.Village; model.CPID = company.CPID; model.DataStatus = 0; model.HaveUpdate = 3; model.LastUpdateTime = DateTime.Now; model.TagID = village.VID; model.ASDID = GuidGenerator.GetGuidString(); List <SysScopeAuthorize> list = new List <SysScopeAuthorize>(); list.Add(model); ISysScopeAuthorize scopeauthorize = SysScopeAuthorizeFactory.GetFactory(); result = scopeauthorize.Add(list, dbOperator); if (!result) { throw new MyException("添加默认用户 用户作用域失败"); } ISysUserRolesMapping roleMappingFactory = SysUserRolesMappingFactory.GetFactory(); List <SysUserRolesMapping> roleMapping = GetSysUserRolesMapping(user.RecordID, role.RecordID); result = roleMappingFactory.Add(roleMapping, dbOperator); if (!result) { throw new MyException("添加默认用户 用户授权角色失败"); } ISysUserScopeMapping userMappingFactory = SysUserScopeMappingFactory.GetFactory(); List <SysUserScopeMapping> scopeMapping = GetSysUserScopeMapping(user.RecordID, scope.ASID); result = userMappingFactory.Add(scopeMapping, dbOperator); if (!result) { throw new MyException("添加默认用户 用户授权作用域失败"); } return(result); }
internal static void SetGuidGenerator(GuidGenerator generator) { guidGenerator = generator; }
/// <summary> /// 创建 Guid ID /// </summary> /// <returns></returns> public static Guid GetGuid() { return(GuidGenerator.Create()); }