protected EventResponse(Guid requestId, bool isSuccess = true, string resultDesc = "") { RequestId = requestId; Id = GuidUtil.NewSequentialId(); IsSuccess = isSuccess; ResultDesc = resultDesc; }
public async Task <BaseApiResponse> AcceptTransfer(AcceptTransferRequest request) { request.CheckNotNull(nameof(request)); var wallet = _walletQueryService.InfoByUserId(request.UserId); if (wallet == null) { return(new BaseApiResponse { Code = 400, Message = "没有该收款人" }); } string number = DateTime.Now.ToSerialNumber(); var command = new CreateCashTransferCommand( GuidUtil.NewSequentialId(), wallet.Id, number, //流水号 CashTransferType.Transfer, CashTransferStatus.Placed, //这里只是提交,只有钱包接受改记录后,才更新为成功 request.Amount, 0, WalletDirection.In, request.Remark); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public ThidPartyProcessorPaymentItem(string description, decimal amount) { Id = GuidUtil.NewSequentialId(); Description = description; Amount = amount; }
public async Task <BaseApiResponse> Add(AddAdminRequest request) { request.CheckNotNull(nameof(request)); var newadminid = GuidUtil.NewSequentialId(); var command = new CreateAdminCommand( newadminid, request.Name, request.LoginName, request.Portrait, PasswordHash.CreateHash(request.Password), request.Role, request.IsLocked ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "添加管理员", newadminid, "管理员:{0}".FormatWith(request.Name)); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> ApplyStore(ApplyStoreRequest request) { request.CheckNotNull(nameof(request)); TryInitUserModel(); var command = new CreateStoreCommand( GuidUtil.NewSequentialId(), _user.Id, request.AccessCode, request.Name, request.Description, request.Region, request.Address, request.Subject.Name, request.Subject.Number, request.Subject.Pic); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
/// <summary> /// 创建用户顺便创建用户的钱包信息 /// </summary> /// <param name="evnt"></param> /// <returns></returns> public Task <AsyncTaskResult> HandleAsync(UserCreatedEvent evnt) { var tasks = new List <Task>(); var number = DateTime.Now.ToSerialNumber(); //创建用户的钱包信息 tasks.Add(_commandService.SendAsync(new CreateWalletCommand(evnt.WalletId, evnt.AggregateRootId))); //创建用户的购物车信息 tasks.Add(_commandService.SendAsync(new CreateCartCommand(evnt.CartId, evnt.AggregateRootId))); //给用户随机余额 tasks.Add(_commandService.SendAsync(new CreateCashTransferCommand( GuidUtil.NewSequentialId(), evnt.WalletId, number, CashTransferType.SystemOp, CashTransferStatus.Placed, RandomArray.NewUserRedPacket(), 0, WalletDirection.In, "新用户红包"))); //执行所以的任务 Task.WaitAll(tasks.ToArray()); return(Task.FromResult(AsyncTaskResult.Success)); }
public async Task <BaseApiResponse> Recharge(RechargeRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext.Current); var command = new CreateCashTransferCommand( GuidUtil.NewSequentialId(), currentAccount.WalletId.ToGuid(), DateTime.Now.ToSerialNumber(), CashTransferType.Charge, CashTransferStatus.Placed, request.Amount, 0, WalletDirection.In, "充值"); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Add(AddThirdCurrencyRequest request) { request.CheckNotNull(nameof(request)); var newthirdcurrencyid = GuidUtil.NewSequentialId(); var command = new CreateThirdCurrencyCommand( newthirdcurrencyid, request.Name, request.Icon, request.CompanyName, request.Conversion, request.IsLocked, request.Remark ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "添加外币", newthirdcurrencyid, request.Name); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> AddUserGift(AddUserGiftRequest request) { request.CheckNotNull(nameof(request)); request.GiftInfo.CheckNotNull(nameof(request.GiftInfo)); request.ExpressAddressInfo.CheckNotNull(nameof(request.ExpressAddressInfo)); TryInitUserModel(); //要将新的ID 返回给前端 var userGiftId = GuidUtil.NewSequentialId(); var command = new AddUserGiftCommand( userGiftId, _user.Id, request.GiftInfo.Name, request.GiftInfo.Size, request.ExpressAddressInfo.Name, request.ExpressAddressInfo.Mobile, request.ExpressAddressInfo.Region, request.ExpressAddressInfo.Address, request.ExpressAddressInfo.Zip); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new AddUserGiftResponse { UserGiftId = userGiftId }); }
public async Task <BaseApiResponse> Add(AddAnnouncementRequest request) { request.CheckNotNull(nameof(request)); var newannouncementid = GuidUtil.NewSequentialId(); var command = new CreateAnnouncementCommand( newannouncementid, request.Title, request.Body ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "发布公告", newannouncementid, request.Title); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> AddUserGift([FromBody] AddUserGiftRequest request) { request.CheckNotNull(nameof(request)); request.GiftInfo.CheckNotNull(nameof(request.GiftInfo)); request.ExpressAddressInfo.CheckNotNull(nameof(request.ExpressAddressInfo)); var currentAccount = _contextService.GetCurrentAccount(HttpContext); //要将新的ID 返回给前端 var userGiftId = GuidUtil.NewSequentialId(); var command = new AddUserGiftCommand( userGiftId, currentAccount.UserId.ToGuid(), request.GiftInfo.Name, request.GiftInfo.Size, request.ExpressAddressInfo.Name, request.ExpressAddressInfo.Mobile, request.ExpressAddressInfo.Region, request.ExpressAddressInfo.Address, request.ExpressAddressInfo.Zip); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new AddUserGiftResponse { UserGiftId = userGiftId }); }
public async Task <BaseApiResponse> IncentiveBenevolence([FromBody] IncentiveBenevolenceRequest request) { request.CheckNotNull(nameof(request)); if (request.BenevolenceIndex <= 0 || request.BenevolenceIndex >= 1) { return(new BaseApiResponse { Code = 400, Message = "善心指数异常" }); } //遍历所有的钱包发送激励指令 var wallets = _walletQueryService.ListPage(); if (wallets.Any()) { var totalBenevolenceAmount = wallets.Where(x => x.Benevolence > 1).Sum(x => x.Benevolence); //创建激励记录 await ExecuteCommandAsync(new CreateBenevolenceIndexCommand( GuidUtil.NewSequentialId(), request.BenevolenceIndex, totalBenevolenceAmount )); foreach (var wallet in wallets) { if (wallet.Benevolence > 1) { var command = new IncentiveBenevolenceCommand(wallet.Id, request.BenevolenceIndex); await ExecuteCommandAsync(command); } } } return(new BaseApiResponse()); }
/// <summary> /// 激励用户善心 /// </summary> /// <param name="message"></param> /// <returns></returns> public Task <AsyncTaskResult> HandleAsync(IncentiveUserBenevolenceMessage message) { //发布两个记录 一个现金记录 一个善心记录 var tasks = new List <Task>(); string number = DateTime.Now.ToSerialNumber(); //现金记录 tasks.Add(_commandService.SendAsync(new CreateCashTransferCommand( GuidUtil.NewSequentialId(), message.WalletId, number, CashTransferType.Incentive, CashTransferStatus.Placed, message.IncentiveValue * (1 - ConfigSettings.IncentiveFeePersent),//激励善心收取10%手续费 message.IncentiveValue * ConfigSettings.IncentiveFeePersent, WalletDirection.In, "善心激励"))); //善心记录 tasks.Add(_commandService.SendAsync(new CreateBenevolenceTransferCommand( GuidUtil.NewSequentialId(), message.WalletId, number, BenevolenceTransferType.Incentive, BenevolenceTransferStatus.Placed, message.BenevolenceDeduct, 0, WalletDirection.Out, "善心指数:{0}".FormatWith(message.BenevolenceIndex)))); //执行所以的任务 Task.WaitAll(tasks.ToArray()); return(Task.FromResult(AsyncTaskResult.Success)); }
public async Task <BaseApiResponse> Add(AddGoodsBlockRequest request) { request.CheckNotNull(nameof(request)); var newgoodsblockid = GuidUtil.NewSequentialId(); var command = new CreateGoodsBlockCommand( newgoodsblockid, request.Name, request.Thumb, request.Banner, request.Layout, request.Goodses, request.IsShow, request.Sort ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //添加操作记录 var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current); RecordOperat(currentAdmin.AdminId.ToGuid(), "添加产品簇", newgoodsblockid, request.Name); return(new BaseApiResponse()); }
public async Task <BaseApiResponse> Comment(CommentRequest request) { request.CheckNotNull(nameof(request)); TryInitUserModel(); var command = new CreateCommentCommand( GuidUtil.NewSequentialId(), request.GoodsId, _user.Id, request.Body, request.Thumbs, request.PriceRate, request.DescribeRate, request.QualityRate, request.ExpressRate ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public void BanUserFromSub(Guid subId, Guid userId, string userName, DateTime dateBanned, Guid bannedBy, string reasonPrivate, string reasonPublic) { _conn.Perform(conn => { var existing = conn.Single <SubUserBan>(x => x.UserId == userId && x.SubId == subId); if (existing != null) { existing.BannedBy = bannedBy; existing.ReasonPrivate = reasonPrivate; existing.ReasonPublic = reasonPublic; existing.DateBanned = dateBanned; conn.Update(existing); } else { existing = new SubUserBan(); existing.Id = GuidUtil.NewSequentialId(); existing.BannedBy = bannedBy; existing.ReasonPrivate = reasonPrivate; existing.ReasonPublic = reasonPublic; existing.DateBanned = dateBanned; existing.SubId = subId; existing.UserId = userId; existing.UserName = userName; conn.Insert(existing); } }); }
public void VoteForPost(Guid postId, Guid userId, string ipAddress, VoteType voteType, DateTime dateCasted) { _conn.Perform(conn => { var vote = conn.Single <Vote>(x => x.UserId == userId && x.PostId == postId); if (vote == null) { conn.Insert(new Vote { Id = GuidUtil.NewSequentialId(), DateCreated = Common.CurrentTime(), UserId = userId, PostId = postId, VoteType = voteType, DateCasted = dateCasted, IpAddress = ipAddress }); } else { if (vote.VoteType != voteType) { conn.Update <Vote>(new { Type = (int)voteType }, x => x.Id == vote.Id); } } }); }
public async Task <BaseApiResponse> Comment(CommentRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext.Current); var command = new CreateCommentCommand( GuidUtil.NewSequentialId(), request.GoodsId, currentAccount.UserId.ToGuid(), request.Body, request.Thumbs, request.PriceRate, request.DescribeRate, request.QualityRate, request.ExpressRate ); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public Task <AsyncTaskResult> HandleAsync(NewOperatRecordEvent evnt) { return(TryTransactionAsync(async(connection, transaction) => { //尽管是更新ExpressAddresssTable但是也要更新聚合跟,因为地址属于聚合跟的状态 var effectedRows = await connection.UpdateAsync(new { Version = evnt.Version, EventSequence = evnt.Sequence }, new { Id = evnt.AggregateRootId, //Version = evnt.Version - 1 }, ConfigSettings.AdminTable, transaction); if (effectedRows == 1) { await connection.InsertAsync(new { Id = GuidUtil.NewSequentialId(), AdminId = evnt.AggregateRootId, AboutId = evnt.Info.AboutId, AdminName = evnt.Info.AdminName, Operat = evnt.Info.Operat, Remark = evnt.Info.Remark, CreatedOn = evnt.Timestamp }, ConfigSettings.AdminOperatRecordTable, transaction); } })); }
public void UpdateStylesForSub(SubCss styles) { _conn.Perform(conn => { var existing = conn.Single <SubCss>(x => x.SubId == styles.SubId); if (existing != null) { existing.CssType = styles.CssType; existing.Embedded = styles.Embedded; existing.ExternalCss = styles.ExternalCss; existing.GitHubCssProjectName = styles.GitHubCssProjectName; existing.GitHubCssProjectTag = styles.GitHubCssProjectTag; existing.GitHubLessProjectName = styles.GitHubLessProjectName; existing.GitHubLessProjectTag = styles.GitHubLessProjectTag; conn.Update(existing); } else { existing = new SubCss(); existing.Id = GuidUtil.NewSequentialId(); existing.SubId = styles.SubId; existing.CssType = styles.CssType; existing.Embedded = styles.Embedded; existing.ExternalCss = styles.ExternalCss; existing.GitHubCssProjectName = styles.GitHubCssProjectName; existing.GitHubCssProjectTag = styles.GitHubCssProjectTag; existing.GitHubLessProjectName = styles.GitHubLessProjectName; existing.GitHubLessProjectTag = styles.GitHubLessProjectTag; conn.Insert(existing); styles.Id = existing.Id; } }); }
public async Task <BaseApiResponse> ApplyStore([FromBody] ApplyStoreRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext); var store = _storeQueryService.InfoByUserId(currentAccount.UserId.ToGuid()); if (store != null) { return(new BaseApiResponse { Code = 400, Message = "您已开店,无法继续开店" }); } var command = new CreateStoreCommand( GuidUtil.NewSequentialId(), currentAccount.UserId.ToGuid(), request.AccessCode, request.Name, request.Description, request.Region, request.Address, request.Subject.Name, request.Subject.Number, request.Subject.Pic); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new BaseApiResponse()); }
public Task <AsyncTaskResult> HandleAsync(NewThirdCurrencyImportLogEvent evnt) { return(TryTransactionAsync(async(connection, transaction) => { var effectedRows = await connection.UpdateAsync(new { Version = evnt.Version, EventSequence = evnt.Sequence }, new { Id = evnt.AggregateRootId, //Version = evnt.Version - 1 }, ConfigSettings.ThirdCurrencyTable, transaction); if (effectedRows == 1) { await connection.InsertAsync(new { Id = GuidUtil.NewSequentialId(), ThirdCurrencyId = evnt.AggregateRootId, WalletId = evnt.LogInfo.WalletId, Mobile = evnt.LogInfo.Mobile, Account = evnt.LogInfo.Account, Amount = evnt.LogInfo.Amount, ShopCashAmount = evnt.LogInfo.ShopCashAmount, Conversion = evnt.LogInfo.Conversion, CreatedOn = evnt.Timestamp }, ConfigSettings.ThirdCurrencyImportLogTable, transaction); } })); }
public async Task <BaseApiResponse> AddGoods(AddGoodsRequest request) { request.CheckNotNull(nameof(request)); TryInitUserModel(); //创建商品 var goodsId = GuidUtil.NewSequentialId(); var command = new CreateGoodsCommand( goodsId, request.StoreId, request.CategoryIds, request.Name, request.Description, request.Pics, request.Price, request.OriginalPrice, request.Stock, request.IsPayOnDelivery, request.IsInvoice, request.Is7SalesReturn, request.Sort); var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } //初始化默认规格 var thumb = ""; if (request.Pics.Any()) { thumb = request.Pics[0]; } var command2 = new AddSpecificationCommand( goodsId, "默认规格", "默认规格", thumb, request.Price, request.Stock, request.OriginalPrice, request.OriginalPrice / 100M, "", ""); var result2 = await ExecuteCommandAsync(command2); if (!result2.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage()) }); } return(new AddGoodsResponse { GoodsId = goodsId }); }
public void Can_build_node_sorted() { // arrange var sub = new Sub(); sub.Id = GuidUtil.NewSequentialId(); sub.Name = "test"; var author = new User(); author.Id = GuidUtil.NewSequentialId(); author.UserName = "******"; var comments = ConvertTestNodesToComments(new List <TestNodeTreeSorted> { TestNodeTreeSorted.Create(10, TestNodeTreeSorted.Create(5), TestNodeTreeSorted.Create(4, TestNodeTreeSorted.Create(2), TestNodeTreeSorted.Create(20))), TestNodeTreeSorted.Create(9, TestNodeTreeSorted.Create(3, TestNodeTreeSorted.Create(1)), TestNodeTreeSorted.Create(12)) }); foreach (var comment in comments) { comment.SubId = sub.Id; comment.AuthorUserId = author.Id; } SetupComments(comments); _membershipService.Setup(x => x.GetUsersByIds(It.IsAny <List <Guid> >())).Returns(new List <User> { author }); _subDao.Setup(x => x.GetSubsByIds(It.IsAny <List <Guid> >())).Returns(new List <Sub> { sub }); // act var tree = _commentTreeBuilder.GetCommentTree(Guid.Empty); var treeContext = _commentTreeContextBuilder.Build(tree, comments.ToDictionary(x => x.Id, x => (double)x.SortConfidence)); var nodes = _commentNodeHierarchyBuilder.Build(tree, treeContext, null); //assert nodes.Count.Should().Be(2); CommentExtensions.As <CommentNode>(nodes[0]).Comment.Comment.SortConfidence.Should().Be(10); CommentExtensions.As <CommentNode>(nodes[0]).Children.Count.Should().Be(2); CommentExtensions.As <CommentNode>(nodes[0].As <CommentNode>().Children[0]).Comment.Comment.SortConfidence.Should().Be(5); CommentExtensions.As <CommentNode>(nodes[0].As <CommentNode>().Children[1]).Comment.Comment.SortConfidence.Should().Be(4); CommentExtensions.As <CommentNode>(nodes[0]).Children[1].Children.Count.Should().Be(2); CommentExtensions.As <CommentNode>(nodes[0].As <CommentNode>().Children[1].Children[0]).Comment.Comment.SortConfidence.Should().Be(20); CommentExtensions.As <CommentNode>(nodes[0].As <CommentNode>().Children[1].Children[1]).Comment.Comment.SortConfidence.Should().Be(2); CommentExtensions.As <CommentNode>(nodes[1]).Comment.Comment.SortConfidence.Should().Be(9); CommentExtensions.As <CommentNode>(nodes[1]).Children.Count.Should().Be(2); CommentExtensions.As <CommentNode>(nodes[1].As <CommentNode>().Children[0]).Comment.Comment.SortConfidence.Should().Be(12); CommentExtensions.As <CommentNode>(nodes[1].As <CommentNode>().Children[1]).Comment.Comment.SortConfidence.Should().Be(3); CommentExtensions.As <CommentNode>(nodes[1]).Children[1].Children.Count.Should().Be(1); CommentExtensions.As <CommentNode>(nodes[1].As <CommentNode>().Children[1].Children[0]).Comment.Comment.SortConfidence.Should().Be(1); }
/// <summary> /// 启用单规格 添加商品时自动启用 /// </summary> /// <param name="specificationInfo"></param> /// <param name="stock"></param> public void AddSpecification(SpecificationInfo specificationInfo, int stock) { if (_reservations.Any()) { throw new Exception("存在预定,不允许修改规格."); } ApplyEvent(new SpecificationAddedEvent(GuidUtil.NewSequentialId(), specificationInfo, stock)); }
public Task <AsyncTaskResult> HandleAsync(GoodsCreatedEvent evnt) { return(TryTransactionAsync(async(connection, transaction) => { var info = evnt.Info; var effectedRows = await connection.InsertAsync(new { Id = evnt.AggregateRootId, StoreId = evnt.StoreId, Name = info.Name, Description = info.Description, Pics = info.Pics.ExpandAndToString("|"), Price = info.Price, OriginalPrice = info.OriginalPrice, Benevolence = info.Benevolence, Stock = info.Stock, SellOut = info.SellOut, IsPayOnDelivery = info.IsPayOnDelivery, IsInvoice = info.IsInvoice, Is7SalesReturn = info.Is7SalesReturn, CreatedOn = evnt.Timestamp, Sort = info.Sort, Rate = 5, RateCount = 0, QualityRate = 5, PriceRate = 5, ExpressRate = 5, DescribeRate = 5, IsPublished = 0, Status = (int)GoodsStatus.UnVerify, RefusedReason = "", Version = evnt.Version, EventSequence = evnt.Sequence }, ConfigSettings.GoodsTable, transaction); var tasks = new List <Task>(); //删除原来的记录 tasks.Add(connection.DeleteAsync(new { GoodsId = evnt.AggregateRootId }, ConfigSettings.GoodsPubCategorysTable, transaction)); //插入新的记录 foreach (var categoryId in evnt.CategoryIds) { tasks.Add(connection.InsertAsync(new { Id = GuidUtil.NewSequentialId(), GoodsId = evnt.AggregateRootId, CategoryId = categoryId }, ConfigSettings.GoodsPubCategorysTable, transaction)); } Task.WaitAll(tasks.ToArray()); })); }
public virtual bool InsertRole(Role role) { if (role.Id != Guid.Empty) { throw new Exception("A role with a predetermined unique ID can not be created. The Id will be generated automatically."); } role.Id = GuidUtil.NewSequentialId(); return(_conn.Perform(conn => conn.Insert(role)) == 1); }
public void ReportPost(Guid postId, Guid reportBy, string reason) { _conn.Perform(conn => conn.Insert(new Report.PostReport { Id = GuidUtil.NewSequentialId(), CreatedDate = Common.CurrentTime(), ReportedBy = reportBy, Reason = reason, PostId = postId })); }
public virtual bool InsertUser(User user) { if (user.Id != Guid.Empty) { throw new Exception("You cannot insert a user with an existing user id"); } user.Id = GuidUtil.NewSequentialId(); user.CreatedDate = Common.CurrentTime(); return(_conn.Perform(conn => conn.Insert(user) == 1)); }
public void Handle(ICommandContext context, CreateGranteeCommand command) { var grantee = new Grantee(GuidUtil.NewSequentialId(), command.Publisher, new GranteeInfo( command.Section, command.Title, command.Description, command.Max, command.Days, DateTime.Now.AddDays(command.Days), command.Pics )); context.Add(grantee); }