public void Mapping(Profile profile) { profile.CreateMap <Order, GetOrdersForContractorDto>() .ForMember(d => d.Client, opt => opt.MapFrom(s => s.Client.User.FirstName + " " + s.Client.User.LastName)) .ForMember(d => d.Category, opt => opt.MapFrom(s => s.Category.DisplayName)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, GetCurrentContractorUserDto>() .ForMember(d => d.Gender, opt => opt.MapFrom(s => new CurrentContracorUserGenderDto { GenderGuid = s.GenderCode.CodeGuid, Name = s.GenderCode.DisplayName })) .ForMember(d => d.City, opt => opt.MapFrom(s => new CurrentContracorUserCityDto { CityGuid = s.Contractor.SingleOrDefault().City.CityGuid, Name = s.Contractor.SingleOrDefault().City.Name })) .ForMember(d => d.Latitude, opt => opt.MapFrom(s => s.Contractor.SingleOrDefault().Latitude)) .ForMember(d => d.Longitude, opt => opt.MapFrom(s => s.Contractor.SingleOrDefault().Longitude)) .ForMember(d => d.Credit, opt => opt.MapFrom(s => s.Contractor.SingleOrDefault().Credit)) .ForMember(d => d.AverageRate, opt => opt.MapFrom(s => s.Contractor.SingleOrDefault().AverageRate)) .ForMember(d => d.ProfileDocument, opt => opt.MapFrom(s => s.ProfileDocument.Path)) .ForMember(d => d.Business, opt => opt.MapFrom(s => new CurrentContracorUserBusinessDto { BusinessGuid = s.Contractor.SingleOrDefault().BusinessTypeCode.CodeGuid, Name = s.Contractor.SingleOrDefault().BusinessTypeCode.DisplayName })) .ForMember(d => d.RegisteredDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <Post, GetSliderPostsDto>() .ForMember(d => d.UserFullName, opt => opt.MapFrom(s => s.User.FirstName + " " + s.User.LastName)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))) .ForMember(d => d.Slug, opt => opt.MapFrom(s => s.Title.Trim().ToLowerInvariant().Replace(" ", "-"))) .ForMember(d => d.Document, opt => opt.MapFrom(s => new FilepondDto { Source = s.Document.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = s.Document.Name, Size = s.Document.Size.ToString(), Type = s.Document.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = s.Document.Path } } })); }
public void Mapping(Profile profile) { profile.CreateMap <OrderRequest, GetChatRoomsDto>() .ForMember(d => d.Client, opt => opt.MapFrom(s => s.Order.Client.User.FirstName + " " + s.Order.Client.User.LastName)) .ForMember(d => d.RecentMessage, opt => opt.MapFrom(s => s.ChatMessage.OrderByDescending(x => x.ModifiedDate).FirstOrDefault().Text)) .ForMember(d => d.IsAllow, opt => opt.MapFrom(s => s.IsAllow)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, GetAllAdminsDto>() .ForMember(d => d.Gender, opt => opt.MapFrom(s => s.GenderCode.DisplayName)) .ForMember(d => d.ProfileImage, opt => opt.MapFrom(s => s.ProfileDocument.Path)) .ForMember(d => d.RegisteredDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <Order, GetClientOrdersDto>() .ForMember(d => d.Category, opt => opt.MapFrom(s => s.Category.DisplayName)) //.ForMember(d => d.Contractor, opt => opt.MapFrom(s => s.Contractor.User.FirstName + " " + s.Contractor.User.LastName)) .ForMember(d => d.RequestsCount, opt => opt.MapFrom(s => s.OrderRequest.Count)) .ForMember(d => d.State, opt => opt.MapFrom(s => s.StateCode.DisplayName)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <OrderRequest, GetOrderRequestsForAdminDto>() .ForMember(d => d.IsAllowed, opt => opt.MapFrom(s => s.IsAllow)) .ForMember(d => d.IsAccepted, opt => opt.MapFrom(s => s.IsAccept)) .ForMember(d => d.IsAccessible, opt => opt.MapFrom(s => (s.Order.StateCodeId == 9 && s.IsAllow) || s.IsAccept)) .ForMember(d => d.Contractor, opt => opt.MapFrom(s => s.Contractor.User.FirstName + " " + s.Contractor.User.LastName)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, GetCurrentAdminUserDto>() .ForMember(d => d.Gender, opt => opt.MapFrom(s => new CurrentAdminUserGenderDto { GenderGuid = s.GenderCode.CodeGuid, Name = s.GenderCode.DisplayName })) .ForMember(d => d.RegisteredDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, GetCurrentClientUserDto>() .ForMember(d => d.Gender, opt => opt.MapFrom(s => s.GenderCode.DisplayName)) .ForMember(d => d.City, opt => opt.MapFrom(s => new CurrentClientUserCityDto { CityGuid = s.Client.SingleOrDefault().City.CityGuid, Name = s.Client.SingleOrDefault().City.Name })) .ForMember(d => d.RegisteredDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, GetAllContractorsDto>() .ForMember(d => d.Gender, opt => opt.MapFrom(s => s.GenderCode.DisplayName)) .ForMember(d => d.ProfileImage, opt => opt.MapFrom(s => s.ProfileDocument.Path)) .ForMember(d => d.City, opt => opt.MapFrom(s => s.Contractor.Select(x => x.City.Name).FirstOrDefault())) .ForMember(d => d.Business, opt => opt.MapFrom(s => s.Contractor.Select(x => x.BusinessTypeCode.Name).FirstOrDefault())) .ForMember(d => d.Latitude, opt => opt.MapFrom(s => s.Contractor.Select(x => x.Latitude).FirstOrDefault())) .ForMember(d => d.Longitude, opt => opt.MapFrom(s => s.Contractor.Select(x => x.Longitude).FirstOrDefault())) .ForMember(d => d.Credit, opt => opt.MapFrom(s => s.Contractor.Select(x => x.Credit).FirstOrDefault())) .ForMember(d => d.AverageRate, opt => opt.MapFrom(s => s.Contractor.Select(x => x.AverageRate).FirstOrDefault())) .ForMember(d => d.RegisteredDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public IActionResult Index() { var accounts = context.Account .Where(x => !x.IsDelete) .OrderByDescending(x => x.ModifiedDate) .Select(x => new AccountViewModel { AccountGuid = x.AccountGuid, UserFullName = x.User.FirstName + " " + x.User.LastName, BankName = string.IsNullOrEmpty(x.BankName) ? Messages.NotSet : x.BankName, AccountName = string.IsNullOrEmpty(x.AccountName) ? Messages.NotSet : x.AccountName, AccountNumber = x.AccountNumber, CardNumber = string.IsNullOrEmpty(x.CardNumber) ? Messages.NotSet : x.CardNumber, Credit = x.Credit, ModifiedDate = PersianDateExtensionMethods.ToPeString(x.ModifiedDate, "yyyy/MM/dd HH:mm") }).ToList(); return(View(accounts)); }
public IActionResult NotPassedStateTransactions() { var transactions = context.Transaction .Where(x => !x.IsDelete && x.StateCodeGuid == Codes.NotPassedState) .OrderByDescending(x => x.ReceiptDate) .Select(x => new TransactionViewModel { TransactionGuid = x.TransactionGuid, AccountNumber = string.IsNullOrEmpty(x.Account.AccountNumber) ? Messages.NotSet : x.Account.AccountNumber, Type = x.TypeCode.DisplayValue, State = x.StateCode.DisplayValue, Cost = x.Cost, AccountSide = x.AccountSide, Description = string.IsNullOrEmpty(x.Description) ? Messages.NotSet : x.Description, IsCheckTransaction = x.IsCheckTransaction, ReceiptDate = PersianDateExtensionMethods.ToPeString(x.ReceiptDate, "yyyy/MM/dd"), ModifiedDate = PersianDateExtensionMethods.ToPeString(x.ModifiedDate, "yyyy/MM/dd HH:mm") }).ToList(); return(View(transactions)); }
public async Task SendMessageAsync(Guid orderRequestGuid, string text) { User currentUser = await _currentUser.GetInfoAsync(); OrderRequest orderRequest = await _chatRoom.GetOrderRequestAsync(orderRequestGuid); if (await _chatRoom.IsOrderRequestAccessibleAsync(orderRequest)) { ChatMessage chatMessage = await _chatRoom.CreateMessageAsync(orderRequest.OrderRequestId, text, currentUser.UserId); string clientName = chatMessage.User.FirstName + " " + chatMessage.User.LastName; string sentAt = PersianDateExtensionMethods.ToPeString(chatMessage.SentAt, "yyyy/MM/dd HH:mm"); await Clients.Group(orderRequestGuid.ToString()) .SendAsync("ReceiveMessage", clientName, chatMessage.Text, sentAt, _currentUser.Role); } else { throw new NotSupportedException("Order Is Closed"); } }
public IActionResult ShowCheckInfo(Guid transactionGuid) { if (transactionGuid == null) { return(BadRequest()); } var checkTransaction = context.CheckTransaction .Where(x => x.TransactionGuid == transactionGuid) .SingleOrDefault(); if (checkTransaction == null) { return(NotFound()); } CheckTransitionViewModel model = new CheckTransitionViewModel() { Serial = string.IsNullOrEmpty(checkTransaction.Serial) ? Messages.NotSet : checkTransaction.Serial, IssueDate = PersianDateExtensionMethods.ToPeString(checkTransaction.IssueDate, "yyyy/MM/dd") }; return(PartialView(model)); }
public void Mapping(Profile profile) { profile.CreateMap <Payment, GetPaymentByGuidDto>() .ForMember(d => d.Contractor, opt => opt.MapFrom(s => s.Contractor.User.FirstName + " " + s.Contractor.User.LastName)) .ForMember(d => d.CreationDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.CreationDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <User, UserDto>() .ForMember(d => d.UserCreateDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.RegisteredDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <ContactUs, GetAllContactUsMessagesDto>() .ForMember(d => d.ContactUsBusinessTypeCode, opt => opt.MapFrom(s => s.ContactUsBusinessTypeCode.DisplayName)) .ForMember(d => d.CreationDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.CreationDate, "yyyy/MM/dd HH:mm"))); }
private async Task <List <CategoryDto> > GetCategoryChildren(List <Category> categories, CategoryDto category) { List <CategoryDto> subCategories = categories .Where(x => x.ParentCategoryId == category.CategoryId && !x.IsDelete) .OrderBy(x => x.Sort) .Select(x => new CategoryDto { CategoryId = x.CategoryId, CategoryGuid = x.CategoryGuid, Title = x.DisplayName, Description = x.Description, Abstract = x.Abstract, Sort = x.Sort, CoverDocument = new FilepondDto { Source = x.CoverDocument?.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.CoverDocument?.Name, Size = x.CoverDocument?.Size.ToString(), Type = x.CoverDocument?.TypeCode?.Name }, Metadata = new FilepondMetadata { Poster = x.CoverDocument?.Path } } }, ActiveIconDocument = new FilepondDto { Source = x.ActiveIconDocument?.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.ActiveIconDocument?.Name, Size = x.ActiveIconDocument?.Size.ToString(), Type = x.ActiveIconDocument?.TypeCode?.Name }, Metadata = new FilepondMetadata { Poster = x.ActiveIconDocument?.Path } } }, InactiveIconDocument = new FilepondDto { Source = x.InactiveIconDocument?.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.InactiveIconDocument?.Name, Size = x.InactiveIconDocument?.Size.ToString(), Type = x.InactiveIconDocument?.TypeCode?.Name }, Metadata = new FilepondMetadata { Poster = x.InactiveIconDocument?.Path } } }, QuadMenuDocument = new FilepondDto { Source = x.QuadMenuDocument?.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.QuadMenuDocument?.Name, Size = x.QuadMenuDocument?.Size.ToString(), Type = x.QuadMenuDocument?.TypeCode?.Name }, Metadata = new FilepondMetadata { Poster = x.QuadMenuDocument?.Path } } }, Tags = x.CategoryTag.OrderBy(x => x.Tag.Name) .Select(x => new GetCategoryTagNameDto { Guid = x.Tag.TagGuid, Name = x.Tag.Name }) as List <GetCategoryTagNameDto> ?? null, IsActive = x.IsActive, ModifiedDate = PersianDateExtensionMethods.ToPeString(x.ModifiedDate, "yyyy/MM/dd HH:mm") }).ToList(); if (subCategories.Count <= 0) { return(new List <CategoryDto>()); } category.Children = subCategories; foreach (CategoryDto subCategory in category.Children) { subCategory.Children = await GetCategoryChildren(categories, subCategory); } return(category.Children); }
public void Mapping(Profile profile) { profile.CreateMap <Advertisement, GetAllAdvertisementsDto>() .ForMember(d => d.DocumentPath, opt => opt.MapFrom(s => s.Document.Path)) .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <Complaint, GetAllComplaintsDto>() .ForMember(d => d.User, opt => opt.MapFrom(s => s.User.FirstName + " " + s.User.LastName)) .ForMember(d => d.CreationDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.CreationDate, "yyyy/MM/dd HH:mm"))); }
public async Task <PrimaryCategoriesVm> Handle(GetPrimaryCategoriesQuery request, CancellationToken cancellationToken) { IQueryable <Category> categories = _context.Category .Where(x => !x.IsDelete); if (request.CategoryGuid.HasValue) { Category category = await _context.Category .SingleOrDefaultAsync(x => x.CategoryGuid == request.CategoryGuid && !x.IsDelete, cancellationToken); if (category == null) { return new PrimaryCategoriesVm() { Message = "دسته بندی مورد نظر یافت نشد", State = (int)GetPrimaryCategoriesState.CategoryNotFound } } ; categories = categories.Where(x => x.ParentCategoryId == category.CategoryId); } else { categories = categories.Where(x => x.ParentCategoryId == null); } List <PrimaryCategoryDto> primaryCategories = await categories.OrderBy(x => x.Sort) .Select(x => new PrimaryCategoryDto { CategoryGuid = x.CategoryGuid, Title = x.DisplayName, Description = x.Description, Abstract = x.Abstract, Sort = x.Sort, CoverDocument = new FilepondDto { Source = x.CoverDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.CoverDocument.Name, Size = x.CoverDocument.Size.ToString(), Type = x.CoverDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.CoverDocument.Path } } }, ActiveIconDocument = new FilepondDto { Source = x.CoverDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.ActiveIconDocument.Name, Size = x.ActiveIconDocument.Size.ToString(), Type = x.ActiveIconDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.ActiveIconDocument.Path } } }, InactiveIconDocument = new FilepondDto { Source = x.CoverDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.InactiveIconDocument.Name, Size = x.InactiveIconDocument.Size.ToString(), Type = x.InactiveIconDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.InactiveIconDocument.Path } } }, QuadMenuDocument = new FilepondDto { Source = x.CoverDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.QuadMenuDocument.Name, Size = x.QuadMenuDocument.Size.ToString(), Type = x.QuadMenuDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.QuadMenuDocument.Path } } }, Tags = x.CategoryTag.OrderBy(x => x.Tag.Name) .Select(x => new GetPrimaryCategoryTagNameDto { Guid = x.Tag.TagGuid, Name = x.Tag.Name }) as List <GetPrimaryCategoryTagNameDto>, IsActive = x.IsActive, ModifiedDate = PersianDateExtensionMethods.ToPeString(x.ModifiedDate, "yyyy/MM/dd HH:mm") }).ToListAsync(cancellationToken); if (primaryCategories.Count <= 0) { return new PrimaryCategoriesVm() { Message = "دسته بندی ای یافت نشد", State = (int)GetPrimaryCategoriesState.NotAnyCategoriesFound, } } ; return(new PrimaryCategoriesVm() { Message = "عملیات موفق آمیز", State = (int)GetPrimaryCategoriesState.Success, PrimaryCategories = primaryCategories }); } } }
public async Task <CategoryDtoResult> GetCategory(Guid parentGuid, bool includeChildren = false) { CategoryDto category = await _context.Category .Where(x => x.CategoryGuid == parentGuid && !x.IsDelete) .Select(x => new CategoryDto { CategoryId = x.CategoryId, CategoryGuid = x.CategoryGuid, Title = x.DisplayName, Description = x.Description, Abstract = x.Abstract, Sort = x.Sort, CoverDocument = new FilepondDto { Source = x.CoverDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.CoverDocument.Name, Size = x.CoverDocument.Size.ToString(), Type = x.CoverDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.CoverDocument.Path } } }, ActiveIconDocument = new FilepondDto { Source = x.ActiveIconDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.ActiveIconDocument.Name, Size = x.ActiveIconDocument.Size.ToString(), Type = x.ActiveIconDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.ActiveIconDocument.Path } } }, InactiveIconDocument = new FilepondDto { Source = x.InactiveIconDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.InactiveIconDocument.Name, Size = x.InactiveIconDocument.Size.ToString(), Type = x.InactiveIconDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.InactiveIconDocument.Path } } }, QuadMenuDocument = new FilepondDto { Source = x.QuadMenuDocument.Path, Options = new FilepondOptions { Type = "local", Files = new FilepondFile { Name = x.QuadMenuDocument.Name, Size = x.QuadMenuDocument.Size.ToString(), Type = x.QuadMenuDocument.TypeCode.Name }, Metadata = new FilepondMetadata { Poster = x.QuadMenuDocument.Path } } }, Tags = x.CategoryTag.OrderBy(x => x.Tag.Name) .Select(x => new GetCategoryTagNameDto { Guid = x.Tag.TagGuid, Name = x.Tag.Name }) as List <GetCategoryTagNameDto>, IsActive = x.IsActive, ModifiedDate = PersianDateExtensionMethods.ToPeString(x.ModifiedDate, "yyyy/MM/dd HH:mm") }).SingleOrDefaultAsync(); if (category == null) { return(null); } if (includeChildren) { List <Category> categories = await _context.Category .Where(x => !x.IsDelete) .ToListAsync(); if (categories.Count <= 0) { return(null); } category.Children = await GetCategoryChildren(categories, category); } else { category.Children = new List <CategoryDto>(); } return(new CategoryDtoResult() { CategoryGuid = category.CategoryGuid, Title = category.Title, Abstract = category.Abstract, Description = category.Description, Sort = category.Sort, CoverDocument = category.CoverDocument, ActiveIconDocument = category.ActiveIconDocument, InactiveIconDocument = category.InactiveIconDocument, QuadMenuDocument = category.QuadMenuDocument, Tags = category.Tags, IsActive = category.IsActive, ModifiedDate = category.ModifiedDate, Children = category.Children }); }
public void Mapping(Profile profile) { profile.CreateMap <CodeGroup, GetAllCodeGroupsDto>() .ForMember(d => d.ModifiedDate, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.ModifiedDate, "yyyy/MM/dd HH:mm"))); }
public void Mapping(Profile profile) { profile.CreateMap <ChatMessage, GetChatMessagesDto>() .ForMember(d => d.From, opt => opt.MapFrom(s => s.User.Role.DisplayName)) .ForMember(d => d.SentAt, opt => opt.MapFrom(s => PersianDateExtensionMethods.ToPeString(s.SentAt, "yyyy/MM/dd HH:mm"))); }