public async Task AddMerchantToBrand(MerchantDto merchant) { await UpdateAsync(merchant.BrandId, async brand => { brand .AddMerchant(merchant.Name, merchant.Surname, merchant.BrandId, merchant.LimitId, _brandPolicy, merchant.Gsm); }); }
public async Task ChangeMerchantVknByBrand(MerchantDto merchant) { await UpdateAsync(merchant.BrandId, async brand => { brand.ChangeOrAddVknToMerchant(merchant.Id, merchant.Vkn) .SyncObjectState(ObjectState.Modified); }); }
public async Task ChangeMerchantVknByBrand(MerchantDto merchant) { var brand = await this._brandRepository.GetBrandAggregate(merchant.BrandId); brand.ChangeOrAddVknToMerchant(merchant.Id, merchant.Vkn) .SyncObjectState(ObjectState.Modified); }
public async Task ChangeMerchantVknByBrand(MerchantDto merchant) { await UpdateAsync(merchant.BrandId, async brand => { brand .ChangeOrAddVknToMerchant(merchant.Id, merchant.Vkn); }); }
/// <summary> /// 转换为商户实体 /// </summary> /// <param name="dto">商户数据传输对象</param> public static Merchant ToEntity(this MerchantDto dto) { if (dto == null) { return(new Merchant()); } return(dto.MapTo(new Merchant(dto.Id.ToGuid()))); }
public async Task Handle(MerchantDeactivated message) { MerchantDto mercDto = _merchantRepository.GetById(message.Id); mercDto.IsActivated = false; mercDto.Version = message.Version; _merchantRepository.Update(mercDto); }
public async Task <string> UpdateRegistrationDetails(MerchantDto MerchantDto) { var merchantDetails = Repository.SingleOrDefault(x => x.Id == MerchantDto.Id); if (!string.IsNullOrEmpty(MerchantDto.Name)) { merchantDetails.Name = MerchantDto.Name; } if (!string.IsNullOrEmpty(MerchantDto.ProfileImage)) { merchantDetails.ProfileImage = MerchantDto.ProfileImage; } if (!string.IsNullOrEmpty(MerchantDto.Company)) { merchantDetails.Company = MerchantDto.Company; } if (!string.IsNullOrEmpty(MerchantDto.CompanyImage)) { merchantDetails.CompanyImage = MerchantDto.CompanyImage; } if (!string.IsNullOrEmpty(MerchantDto.Website)) { merchantDetails.Website = MerchantDto.Website; } if (MerchantDto.Country > 0) { merchantDetails.Country = MerchantDto.Country; } if (!string.IsNullOrEmpty(MerchantDto.Categories)) { string returnstatus = await _MerchantCategoryService.deleteMerchantCategories(MerchantDto.Id, MerchantDto.Categories); if (returnstatus == "Success") { await _MerchantCategoryService.InsertMerchantCategory(MerchantDto.Id, MerchantDto.Categories); merchantDetails.Categories = MerchantDto.Categories; } else { return("Fail"); } } if (!string.IsNullOrEmpty(MerchantDto.SellCountries)) { await _MerchantSellCountriesService.deleteMerchantCountries(MerchantDto.Id); await _MerchantSellCountriesService.InsertSellCountriesDetails(MerchantDto.Id, MerchantDto.SellCountries); merchantDetails.SellCountries = MerchantDto.SellCountries; } await Repository.UpdateAsync(merchantDetails); return("Success"); }
public async Task <Merchant> GetMerchantDetailsByStatus(MerchantDto MerchantDto) { var isvalid = Repository.Where(x => x.Email == MerchantDto.Email && x.MerchantRequest.LookupTypeValues.Description == "Approved").SingleOrDefault(); if (isvalid == null) { return(null); } return(isvalid); }
public async Task <Merchant> GetMerchantDetails(MerchantDto MerchantDto) { var isvalid = Repository.SingleOrDefault(x => x.Email == MerchantDto.Email); if (isvalid == null) { return(null); } return(isvalid); }
public async Task AddMerchantToBrand(MerchantDto merchant) { var brand = await this._brandRepository.GetAsync(merchant.BrandId); brand .AddMerchant(merchant.Name, merchant.Surname, merchant.BrandId, merchant.LimitId, _brandPolicy, merchant.Gsm) .SyncObjectState(ObjectState.Added); this._brandRepository.Update(brand); }
public async Task <bool> Insert(MerchantDto dto) { var entity = ObjectMapper.Map <MerchantDto, Merchant>(dto); var post = await _merchantRepository.InsertAsync(entity); if (post == null) { return(false); } return(true); }
public async Task Handle(OfferPublishedToMerchant message) { MerchantDto mercDto = _merchantRepository.GetById(message.MerchantId); if (!mercDto.VisibleOffersIds.Contains(message.OfferId)) { mercDto.VisibleOffersIds.Add(message.OfferId); } mercDto.VisibleOffers = mercDto.VisibleOffersIds.Count(); mercDto.IsVisible = mercDto.VisibleOffers > 0 ? true : false; _merchantRepository.Update(mercDto); }
public ActionResult Edit(MerchantDto Merchantdto) { ResultJsonInfo resultJsonInfo = new ResultJsonInfo() { Data = "", ErrorMsg = "", Success = true }; if (Merchantdto != null) { Merchantdto.UpdateUser = ServiceHelper.GetCurrentUser().UserName; Merchantdto.UpdateTime = DateTime.Now; } return(Json(new { resultJsonInfo }, JsonRequestBehavior.AllowGet)); }
public ActionResult Add(MerchantDto Merchantdto) { ResultJsonInfo resultJsonInfo = new ResultJsonInfo() { Data = "", ErrorMsg = "", Success = true }; if (Merchantdto != null) { Merchantdto.CreateUser = ServiceHelper.GetCurrentUser().UserName; Merchantdto.CredateTime = DateTime.Now; } return(this.Ajax_JGClose()); }
public async Task Handle(OfferCreated message) { MerchantDto mercDto = _merchantRepository.GetById(message.MerchantId); if (!mercDto.OffersIds.Contains(message.OfferId)) { mercDto.OffersIds.Add(message.OfferId); } mercDto.TotalOffers = mercDto.OffersIds.Count(); mercDto.Version = message.Version; _merchantRepository.Update(mercDto); }
public async Task <IActionResult> updateMerchantAccountDetails([FromBody] UpdateMerchantAccountDetailsDto UpdateMerchantAccountDetailsDto) { try { string returnstatus = string.Empty; if (UpdateMerchantAccountDetailsDto.Id > 0) { returnstatus = await _MerchantAccountDetailsService.UpdateMerchantAccountDetails(UpdateMerchantAccountDetailsDto); } else { MerchantDto MerchantDto = new MerchantDto(); MerchantDto.Email = UpdateMerchantAccountDetailsDto.MerchantEmail; var getMerchantID = await _MerchantService.GetMerchantDetails(MerchantDto); InsertMerchantAccountDetailsDto InsertMerchantAccountDetailsDto = new InsertMerchantAccountDetailsDto(); InsertMerchantAccountDetailsDto.MerchantId = getMerchantID.Id; InsertMerchantAccountDetailsDto.AccountCR = UpdateMerchantAccountDetailsDto.AccountCR; InsertMerchantAccountDetailsDto.BrandAccount = UpdateMerchantAccountDetailsDto.BrandAccount; InsertMerchantAccountDetailsDto.BankName = UpdateMerchantAccountDetailsDto.BankName; InsertMerchantAccountDetailsDto.AccountNumber = UpdateMerchantAccountDetailsDto.AccountNumber; InsertMerchantAccountDetailsDto.Address = UpdateMerchantAccountDetailsDto.Address; InsertMerchantAccountDetailsDto.Swiftcode = UpdateMerchantAccountDetailsDto.Swiftcode; returnstatus = await _MerchantAccountDetailsService.InsertMerchantAccountDetails(InsertMerchantAccountDetailsDto); } if (returnstatus == "Success") { return(Ok(new GenericResultDto <string> { Result = "Merchant AccountDetails updated successfully" })); } else { return(Ok(new GenericResultDto <string> { Result = "Merchant AccountDetails updated Not successfully" })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } }
public async Task <IActionResult> GetMerchant([FromBody] MerchantDto MerchantDto) { try { strMerchantImages = _configuration["FilePath:ImagePath"] + "MerchantImages/"; string strServerURL = _configuration["FilePath:ServerURL"] + "MerchantImages/"; var _getALLMerchantDetails = await _MerchantService.GetMerchantDetails(MerchantDto); if ((System.IO.File.Exists(strMerchantImages + _getALLMerchantDetails.ProfileImage + ""))) { if (_getALLMerchantDetails.ProfileImage != null) { MerchantDto.ProfileImage = strServerURL + _getALLMerchantDetails.ProfileImage; } else { MerchantDto.ProfileImage = strServerURL + "Dummy.jpg"; } } else { MerchantDto.ProfileImage = strServerURL + "Dummy.jpg"; } if ((System.IO.File.Exists(strMerchantImages + _getALLMerchantDetails.CompanyImage))) { if (_getALLMerchantDetails.CompanyImage != null) { MerchantDto.CompanyImage = strServerURL + _getALLMerchantDetails.CompanyImage; } else { MerchantDto.CompanyImage = strServerURL + "Dummy.jpg"; } } else { MerchantDto.CompanyImage = strServerURL + "Dummy.jpg"; } return(Ok(MerchantDto)); } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } }
public async Task Handle(OfferUnpublishedFromMerchant message) { MerchantDto mercDto = _merchantRepository.GetById(message.MerchantId); if (mercDto.VisibleOffersIds.Contains(message.OfferId)) { mercDto.VisibleOffersIds.Remove(message.OfferId); } mercDto.VisibleOffers = mercDto.VisibleOffersIds.Count(); mercDto.IsVisible = mercDto.VisibleOffers > 0 ? true : false; mercDto.Version = message.Version; _merchantRepository.Update(mercDto); }
public async Task <MerchantDto> Update(string merchantname, MerchantDto dto) { var merchant = await _merchantRepository.GetAsync(a => a.MerchantName == merchantname); //获取merchantname所对应的merchant var entity = ObjectMapper.Map <MerchantDto, Merchant>(dto); //创建实体 merchant.MerchantNo = entity.MerchantNo; //赋值 merchant.MerchantName = entity.MerchantName; merchant.MerchantPassword = entity.MerchantPassword; merchant.MerchantTel = entity.MerchantTel; merchant = await _merchantRepository.UpdateAsync(merchant); //更新 var update_dto = ObjectMapper.Map <Merchant, MerchantDto>(merchant); //转化为Dto,返回web return(update_dto); }
//GET: /api/Users/Get/{id} public async Task <ActionResult <MerchantDto> > Get([FromRoute] string id) { var user = await _userManager.FindByIdAsync(id); if (user == null) { return(NotFound(new { message = "User was not found." })); } MerchantDto merchantDto = new MerchantDto() { Email = user.Email, UserName = user.UserName }; return(Ok(merchantDto)); }
public IActionResult GetMerchantOfATransaction(int transactionId) { //TO DO - Validate transactionId var merchant = _merchantRepository.GetMerchantOfATransaction(transactionId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var merchantDto = new MerchantDto() { Id = merchant.Id, Name = merchant.Name }; return(Ok(merchantDto)); }
public async Task <Result> CreateMerchant(MerchantDto merchantDto) { const string sql = @" INSERT INTO [dbo].[Merchant] VALUES ( @UniqueId, @IsActive, @Currency, @WebsiteUrl, @Country, @DiscountPercentage, @CreatedTime, @UpdatedTime ) "; var parameters = new { merchantDto.UniqueId, merchantDto.IsActive, merchantDto.Currency, merchantDto.WebsiteUrl, merchantDto.Country, merchantDto.DiscountPercentage, CreatedTime = DateTime.Now, UpdatedTime = (DateTime?)null }; try { await _dbConnection.ExecuteAsync( sql, parameters, commandType : CommandType.Text); return(Result.Ok()); } catch (Exception exception) { _logger.LogError($"Error on executing {nameof(CreateMerchant)}"); return(Result.Fail(exception.Message)); } }
/// <summary> /// 转换为商户实体 /// </summary> /// <param name="dto">商户数据传输对象</param> public static Merchant ToEntity2(this MerchantDto dto) { if (dto == null) { return(new Merchant()); } return(new Merchant(dto.Id.ToGuid()) { Name = dto.Name, IsEnabled = dto.IsEnabled, Type = dto.Type, IsDistribution = dto.IsDistribution, CreationTime = dto.CreationTime, CreatorId = dto.CreatorId, LastModificationTime = dto.LastModificationTime, LastModifierId = dto.LastModifierId, IsDeleted = dto.IsDeleted, Version = dto.Version, }); }
/// <summary> /// 转换为商户实体 /// </summary> /// <param name="dto">商户数据传输对象</param> public static Merchant ToEntity3(this MerchantDto dto) { if (dto == null) { return(new Merchant()); } return(MerchantFactory.Create( merchantId: dto.Id.ToGuid(), name: dto.Name, isEnabled: dto.IsEnabled, type: dto.Type, isDistribution: dto.IsDistribution, creationTime: dto.CreationTime, creatorId: dto.CreatorId, lastModificationTime: dto.LastModificationTime, lastModifierId: dto.LastModifierId, isDeleted: dto.IsDeleted, version: dto.Version )); }
public async Task <Result> UpdateMerchant(MerchantDto merchantDto) { const string sql = @" UPDATE [dbo].[Merchant] SET IsActive = @IsActive, Currency = @Currency, WebsiteUrl = @WebsiteUrl, Country = @Country, DiscountPercentage = @DiscountPercentage, UpdatedTime = @UpdatedTime WHERE UniqueId = @UniqueId "; var parameters = new { merchantDto.UniqueId, merchantDto.IsActive, merchantDto.Currency, merchantDto.WebsiteUrl, merchantDto.Country, merchantDto.DiscountPercentage, UpdatedTime = DateTime.Now }; try { await _dbConnection.ExecuteAsync( sql, parameters, commandType : CommandType.Text); return(Result.Ok()); } catch (Exception exception) { _logger.LogError($"Error on executing {nameof(UpdateMerchant)}"); return(Result.Fail(exception.Message)); } }
//POST: /api/Users/Register public async Task <IActionResult> Register(MerchantDto model) { var user = new Merchant() { UserName = model.UserName, Email = model.Email }; try { var result = await _userManager.CreateAsync(user); await _userManager.AddPasswordAsync(user, model.Password); return(CreatedAtAction(nameof(Get), new { id = user.Id }, user)); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public Task <IActionResult> AddMerchantToBrand([FromBody] MerchantDto request) => HandleOrThrow(request, async(r) => await this._customerAppServ.AddMerchantToBrand(r));
public async Task <MerchantDto> UpdateMerchant(string merchantname, MerchantDto dto) { var user = await _merchantAppService.Update(merchantname, dto); return(user); }
public async Task <bool> InsertMerchant(MerchantDto dto) { return(await _merchantAppService.Insert(dto)); }
public async Task <IActionResult> InsertDealDetails([FromBody] DealDto DealDto) { string Dealstatus = ""; try { strImagePath = _configuration["FilePath:ImagePath"] + "DealsImages/"; if (!Directory.Exists(strImagePath)) { Directory.CreateDirectory(strImagePath); } if (DealDto.EnglishImage != "") { Byte[] EnglishimageByteData = Convert.FromBase64String(DealDto.EnglishImage); var Englishfs = new BinaryWriter(new FileStream(strImagePath + DealEnglishImages + ".jpg", FileMode.Append, FileAccess.Write)); Englishfs.Write(EnglishimageByteData); Englishfs.Close(); DealDto.EnglishImage = DealEnglishImages + ".jpg"; } else { DealDto.EnglishImage = ""; } if (DealDto.ArabicImage != "") { Byte[] ArabicimageByteData = Convert.FromBase64String(DealDto.ArabicImage); var Arabicfs = new BinaryWriter(new FileStream(strImagePath + DealArabicImages + ".jpg", FileMode.Append, FileAccess.Write)); Arabicfs.Write(ArabicimageByteData); Arabicfs.Close(); DealDto.ArabicImage = DealArabicImages + ".jpg"; } else { DealDto.ArabicImage = ""; } MerchantDto MerchantDto = new MerchantDto(); MerchantDto.Email = DealDto.MerchantEmail; var getMerchantID = await _MerchantService.GetMerchantDetails(MerchantDto); Dealstatus = await _DealsService.InsertDealDetails(DealDto, getMerchantID.Id); int Dealid = await _DealsService.GetDealid(getMerchantID.Id, DealDto.Countries, DealDto.ArabicImage, DealDto.EnglishImage); if (Dealid > 0 && Dealstatus == "Deal created successfully") { await _MerchantDealService.InsertMerchantDealDetails(getMerchantID.Id, DealDto.Countries, Dealid); return(Ok(new GenericResultDto <string> { Result = Dealstatus })); } return(BadRequest(new GenericResultDto <string> { Result = Dealstatus })); } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } }