Exemple #1
0
 public ActionResult <UserProfileDto> Update(int profileId, [FromBody] UserProfileDto dto)
 {
     return(Ok(_repository.Update(profileId, dto)));
 }
Exemple #2
0
 public async Task GetUserForEdit(UserProfileDto input)
 {
     await _unitOfWork.UserProfiles.GetUserForEdit(input);
 }
Exemple #3
0
 public List <UserProfileDto> GetAllUsers(UserProfileDto input)
 {
     return(_unitOfWork.UserProfiles.GetAllUsers(input));
 }
Exemple #4
0
        public async Task <ApiResponseDto> Upsert(UserProfileDto userProfile)
        {
            HttpResponseMessage response = await _httpClient.PostAsJsonAsync("api/UserProfile/Upsert", userProfile);

            return(JsonConvert.DeserializeObject <ApiResponseDto>(await response.Content.ReadAsStringAsync()));
        }
 public UserProfileDto SaveUserProfile(long userId, UserProfileDto profile)
 {
     throw new NotImplementedException();
 }
 public async Task <ApiResponseDto> Upsert(UserProfileDto userProfile)
 {
     return(await _httpClient.PostJsonAsync <ApiResponseDto>("api/UserProfile/Upsert", userProfile));
 }
Exemple #7
0
 public FollowUserFromProfileSuccessAction(UserProfileDto profile) =>
 public async Task <ApiResponse> Upsert(UserProfileDto userProfile)
 => ModelState.IsValid ?
 await _userProfileManager.Upsert(userProfile) :
 new ApiResponse(Status400BadRequest, "User Model is Invalid");
Exemple #9
0
 public NewUserCommand(UserProfileDto newUser, string password)
 {
     NewUser  = newUser;
     Password = password;
 }
 public async Task <ActionResult <UserProfileDto> > Update(int profileId, [FromBody] UserProfileDto dto)
 {
     return(Ok(await _repository.Update(profileId, dto)));
 }
 public async Task <IActionResult> UpsertUserProfileAsync([FromBody, Required] UserProfileDto userProfileDto)
 {
     return(Ok(await _repo.UpsertProfileAsync(userProfileDto)));
 }
Exemple #12
0
 public async void UpdateUserProfile(UserProfileDto userProfileToUpdate)
 {
     await _httpClient.PutAsJsonAsync("api/UserProfiles", userProfileToUpdate);
 }
Exemple #13
0
 public async void AddNewUserProfile(UserProfileDto userProfileToAdd)
 {
     await _httpClient.PostAsJsonAsync("api/UserProfiles", userProfileToAdd);
 }
        public IActionResult Update(int userId, [FromBody] UserProfileDto dto)
        {
            var result = _userProfile.Update(userId, dto);

            return(Ok(result));
        }
        //public AdminServices(IUserProfileRepository userProfileRepository, IMapper mapper)
        //{
        //    _userProfileRepository = userProfileRepository;
        //    _mapper = mapper;
        //}

        #endregion

        // #region Public Method
        //public IPagedResults<UserProfileResponse> GetBlogs(UserProfileDto request)
        //{
        //    var response = new PagedResults<UserProfileResponse>();
        //    var query = _userProfileRepository.GetAllNoneDeleted();
        //    response.Total = query.Count();

        //    //sort  data
        //    if (!string.IsNullOrEmpty(request?.SortField))
        //    {
        //        OrderBy(ref query, request);
        //    }
        //    else
        //    {
        //        query = query.OrderBy(x => x.DisplayName);
        //    }

        //    if (request?.Skip != null && request.Take.HasValue)
        //    {
        //        Paging(ref query, request);
        //    }

        //    var result = _mapper.Map<List<UserProfileResponse>>(query.ToList());

        //    response.Data = result;
        //    return response;
        //}

        //public async Task<int?> SaveBlog(UserProfileModel request)
        //{
        //    if (request.Id != null)
        //    {
        //        var blog = _userProfileRepository.GetSingleNoneDeleted(x => x.Id == request.Id);
        //        //update
        //        if (blog != null)
        //        {
        //            blog.DisplayName = request.Name;
        //            blog.ModifiedDate = Constants.GetDateNow();
        //            blog.ModifiedBy = Constants.GetUserId();
        //            _userProfileRepository.Update(blog);
        //            await _userProfileRepository.CommitAsync();
        //        }
        //        if (blog != null) return blog.Id;
        //    }
        //    else
        //    {
        //        //add new
        //        var userProfile = new UserProfile
        //        {
        //            DisplayName = request.Name,
        //            CreatedBy = Constants.GetUserId(),
        //            ModifiedBy = Constants.GetUserId(),
        //            CreatedDate = Constants.GetDateNow(),
        //            ModifiedDate = Constants.GetDateNow()
        //        };
        //        _userProfileRepository.Add(userProfile);
        //        await _userProfileRepository.CommitAsync();
        //        return userProfile.Id;
        //    }
        //    return null;
        //}

        //public bool DeleteCategories(int request)
        //{
        //    var blog = _userProfileRepository.GetSingleNoneDeleted(x => x.Id == request);
        //    if (blog != null)
        //    {
        //        blog.IsDeleted = true;
        //        blog.DeletedBy = Constants.GetUserId();
        //        blog.DeletedDate = Constants.GetDateNow();
        //        _userProfileRepository.Update(blog);
        //        return _userProfileRepository.Commit();
        //    }
        //    else
        //    {
        //        return false;
        //    }
        // }

        //     #endregion

        #region Private Method


        #endregion

        public IPagedResults <UserProfileResponse> GetBlogs(UserProfileDto request)
        {
            throw new System.NotImplementedException();
        }
Exemple #16
0
 public void ItExists()
 {
     var dto = new UserProfileDto();
 }
Exemple #17
0
 public MemberUpdatedEvent WithUserProfile(UserProfileDto userProfile)
 {
     UserProfile = userProfile;
     return(this);
 }
Exemple #18
0
        public async Task <IActionResult> Login([FromBody] UserForLoginDto userForLoginDto)

        {
            var user = await _authService.FindByNameAsync(userForLoginDto.Username);

            if (user == null)
            {
                return(NotFound());
            }

            var result = await _authService
                         .Login(userForLoginDto.Username, userForLoginDto.Password);

            if (result == null)
            {
                return(NotFound());
            }
            var subscribeLine = new bool();

            if (!user.AccessTokenLineNotify.IsNullOrEmpty())
            {
                // await _lineService.SendWithSticker(new MessageParams {Message = $"Hi {user.Username}! Welcome to Task Management System!", Token = user.AccessTokenLineNotify, StickerPackageId = "2", StickerId = "41" });
                subscribeLine = true;
            }
            var userprofile = new UserProfileDto()
            {
                User = new UserForReturnLogin
                {
                    Username      = user.Username,
                    Role          = user.RoleID,
                    ID            = user.ID,
                    OCLevel       = user.LevelOC,
                    ListOCs       = await _oCService.ListOCIDofUser(user.OCID),
                    IsLeader      = user.isLeader,
                    image         = user.ImageBase64,
                    SubscribeLine = subscribeLine,
                    Systems       = user.UserSystems.Where(x => x.Status == true).Select(x => x.SystemID).ToList()
                },
                //Menus = JsonConvert.SerializeObject(await _authService.GetMenusAsync(user.Role))
            };
            var token = GenerateJwtToken(result);

            if (userForLoginDto.SystemCode == 0)
            {
                return(Ok(new
                {
                    token,
                    user = userprofile
                }));
            }
            await this._authService.SignInHistory(new SignInHistory
            {
                Token       = token,
                UserID      = user.ID,
                Username    = user.Username,
                SystemCode  = userForLoginDto.SystemCode,
                Host        = $"{Request.HttpContext.Connection.RemoteIpAddress.ToString()}:{Request.HttpContext.Connection.RemotePort.ToString()}",
                LoginTime   = DateTime.Now,
                CreatedDate = DateTime.Now
            });

            return(Ok(new
            {
                token,
                user = userprofile
            }));
        }
Exemple #19
0
        public async Task <IActionResult> UpdateProfile([FromBody] UserProfileDto profile)
        {
            await _userService.UpdateUserProfile(Guid.Parse(User.Claims.Single(x => x.Type == ClaimTypes.Sid).Value), profile);

            return(Ok());
        }
Exemple #20
0
 private static int GetInnovationPoints(UserProfileDto model)
 {
     return(model.CommentsCount + (model.IdeasCount * 10));
 }
Exemple #21
0
        public override UpdateCartResult Execute(IUnitOfWork unitOfWork, UpdateCartParameter parameter, UpdateCartResult result)
        {
            if (!parameter.Status.EqualsIgnoreCase("AwaitingApproval"))
            {
                return(this.NextHandler.Execute(unitOfWork, parameter, result));
            }
            CustomerOrder cart = result.GetCartResult.Cart;

            try
            {
                if (parameter.Status.EqualsIgnoreCase("AwaitingApproval") && result.GetCartResult.Cart != null)
                {
                    CustomerOrder  order         = result.GetCartResult.Cart;
                    string         approverEmail = string.IsNullOrEmpty(order.ApproverUserProfile.Email) ? "" : order.ApproverUserProfile.Email;
                    UserProfileDto userProfile   = SiteContext.Current.UserProfileDto;
                    dynamic        emailModel    = new ExpandoObject();
                    emailModel.OrderNumber = order.OrderNumber;
                    emailModel.Name        = order.PlacedByUserName;
                    emailModel.Approver    = order.ApproverUserProfile.FirstName;
                    emailModel.Reason      = order.ApproverMessage;
                    emailModel.totalCost   = order.ShippingCharges;
                    DateTime date = order.OrderDate.Date;
                    emailModel.OrderDate  = date.ToShortDateString();
                    emailModel.CustomerPO = order.CustomerPO;
                    emailModel.OrderLines = new List <ExpandoObject>();
                    foreach (OrderLine orderLine in order.OrderLines)
                    {
                        dynamic expandoObjects = new ExpandoObject();
                        expandoObjects.ProductNumber        = orderLine.Product.ErpNumber;
                        expandoObjects.Description          = orderLine.Description;
                        expandoObjects.QtyOrdered           = decimal.Round(orderLine.QtyOrdered, 2);
                        expandoObjects.QtyOrderedDisplay    = expandoObjects.QtyOrdered.ToString("0.##");
                        expandoObjects.UnitNetPrice         = orderLine.UnitNetPrice;
                        expandoObjects.UnitNetPriceDisplay  = this.CurrencyFormatProvider.GetString(orderLine.UnitNetPrice, order.Currency);
                        expandoObjects.ExtendedUnitNetPrice = this.OrderLineUtilities.GetTotalNetPrice(orderLine);
                        dynamic currency = expandoObjects;
                        ICurrencyFormatProvider currencyFormatProvider = this.CurrencyFormatProvider;
                        currency.ExtendedUnitNetPriceDisplay = currencyFormatProvider.GetString(expandoObjects.ExtendedUnitNetPrice, order.Currency);
                        emailModel.OrderLines.Add(expandoObjects);
                    }
                    emailModel.Shipping       = result.GetCartResult.ShippingAndHandling;
                    emailModel.SubTotal       = result.GetCartResult.OrderSubTotal;
                    emailModel.Tax            = result.GetCartResult.TotalTax;
                    emailModel.OrderTotal     = result.GetCartResult.OrderGrandTotal;
                    emailModel.CustomerNumber = order.CustomerNumber;
                    emailModel.BTCompanyName  = order.BTCompanyName;
                    emailModel.BTAddress1     = order.BTAddress1;
                    emailModel.BTAddress2     = order.BTAddress2;
                    emailModel.BTAddress3     = order.BTAddress3;
                    emailModel.BTCity         = order.BTCity;
                    emailModel.BTState        = order.BTState;
                    emailModel.BTPostalCode   = order.BTPostalCode;
                    emailModel.STCompanyName  = order.STCompanyName;
                    emailModel.STAddress1     = order.STAddress1;
                    emailModel.STAddress2     = order.STAddress2;
                    emailModel.STAddress3     = order.STAddress3;
                    emailModel.STCity         = order.STCity;
                    emailModel.STState        = order.STState;
                    emailModel.STPostalCode   = order.STPostalCode;
                    emailModel.BTDisplayName  = order.BTFirstName + " " + order.BTLastName;
                    emailModel.STDisplayName  = order.STFirstName + " " + order.STLastName;
                    emailModel.BTFirstName    = order.BTFirstName;
                    emailModel.BTLastName     = order.BTLastName;
                    emailModel.STFirstName    = order.STFirstName;
                    emailModel.STLastName     = order.STLastName;
                    if (order.ShipVia != null && order.ShipVia.Carrier != null)
                    {
                        emailModel.ShipMethod = order.ShipVia.Description;
                    }
                    else
                    {
                        emailModel.ShipMethod = string.Empty;
                    }
                    emailModel.Notes                  = order.Notes;
                    emailModel.Handling               = order.HandlingCharges;
                    emailModel.HandlingDisplay        = this.CurrencyFormatProvider.GetString(order.HandlingCharges, order.Currency);
                    emailModel.OrderSubTotalDisplay   = this.CurrencyFormatProvider.GetString(result.GetCartResult.OrderSubTotal, order.Currency);
                    emailModel.OrderGrandTotalDisplay = this.CurrencyFormatProvider.GetString(result.GetCartResult.OrderGrandTotal, order.Currency);
                    emailModel.OrderTotalDueDisplay   = this.CurrencyFormatProvider.GetString(result.GetCartResult.OrderGrandTotal, order.Currency);
                    emailModel.CustomerOrderTaxes     = new List <ExpandoObject>();
                    foreach (CustomerOrderTax customerOrderTax in
                             from o in order.CustomerOrderTaxes
                             orderby o.SortOrder
                             select o)
                    {
                        dynamic expandoObjects = new ExpandoObject();
                        expandoObjects.TaxCode          = this.TranslationLocalizer.Value.TranslateLabel(customerOrderTax.TaxCode);
                        expandoObjects.TaxDescription   = this.TranslationLocalizer.Value.TranslateLabel(customerOrderTax.TaxDescription);
                        expandoObjects.TaxRate          = customerOrderTax.TaxRate;
                        expandoObjects.TaxAmount        = customerOrderTax.TaxAmount;
                        expandoObjects.TaxAmountDisplay = this.CurrencyFormatProvider.GetString(customerOrderTax.TaxAmount, order.Currency);
                        expandoObjects.SortOrder        = customerOrderTax.SortOrder;
                        emailModel.CustomerOrderTaxes.Add(expandoObjects);
                    }
                    emailModel.CreditCardWillBeCharged = result.GetCartResult.OrderGrandTotal;
                    emailModel.TotalTaxDisplay         = this.CurrencyFormatProvider.GetString(result.GetCartResult.TotalTax, order.Currency);

                    var promotionProductDiscountTotal = this.CustomerOrderUtilities.Value.GetPromotionProductDiscountTotal(order);
                    emailModel.PromotionProductDiscountTotal        = promotionProductDiscountTotal;
                    emailModel.PromotionProductDiscountTotalDisplay = this.CurrencyFormatProvider.GetString(promotionProductDiscountTotal, order.Currency);

                    var promotionOrderDiscountTotal = this.CustomerOrderUtilities.Value.GetPromotionOrderDiscountTotal(order);
                    emailModel.PromotionOrderDiscountTotal        = promotionOrderDiscountTotal;
                    emailModel.PromotionOrderDiscountTotalDisplay = this.CurrencyFormatProvider.GetString(promotionOrderDiscountTotal, order.Currency);

                    var promotionShippingDiscountTotal = this.CustomerOrderUtilities.Value.GetPromotionShippingDiscountTotal(order);
                    emailModel.PromotionShippingDiscountTotal        = promotionShippingDiscountTotal;
                    emailModel.PromotionShippingDiscountTotalDisplay = this.CurrencyFormatProvider.GetString(promotionShippingDiscountTotal, order.Currency);

                    var giftCardTotal = this.CustomerOrderUtilities.Value.GetGiftCardTotal(order);
                    emailModel.GiftCardTotal        = giftCardTotal;
                    emailModel.GiftCardTotalDisplay = this.CurrencyFormatProvider.GetString(giftCardTotal, order.Currency);
                    //changes for BUSA-401 starts
                    //emailModel.WebsiteUrl = order.Website.DomainName;
                    //changes for BUSA-401 ends

                    emailModel.WebsiteUrl = HttpContext.Current.Request.ActualUrl().GetLeftPart(UriPartial.Authority);//BUSA-552 : Incorrect URL in Order Approve email template

                    var emailList = this.GetOrCreateEmailList("OrderApprove", "You have a new order to approve");
                    //this.EmailService.SendEmailList(emailList.Id, approverEmail, emailModel, string.Format("{0} {1}", emailList.Subject, order.OrderNumber), this.UnitOfWork);
                    //BUSA-489 - commented the above line and added the below block

                    //BUSA - 489 - start
                    emailList = unitOfWork.GetRepository <EmailList>().GetTable().Expand((EmailList x) => x.EmailTemplate).FirstOrDefault((EmailList x) => x.Id == emailList.Id);
                    if (emailList != null)
                    {
                        SendEmailParameter sendEmailParameter = new SendEmailParameter();
                        string             htmlTemplate       = GetHtmlTemplate(emailList);
                        sendEmailParameter.Body = this.EmailService.ParseTemplate(htmlTemplate, emailModel);

                        sendEmailParameter.Subject = string.Format("{0} {1}", emailList.Subject, order.OrderNumber);
                        sendEmailParameter.ToAddresses.Add(approverEmail);
                        sendEmailParameter.BccAddresses = new List <string>();

                        var emailCCAddresses = customSettings.EmailCCAddresses;
                        if (!string.IsNullOrEmpty(emailCCAddresses))
                        {
                            sendEmailParameter.CCAddresses.Add(emailCCAddresses);
                        }
                        string defaultEmailAddress = customSettings.DefaultEmailAddress;
                        sendEmailParameter.FromAddress = (emailList.FromAddress.IsBlank() ? defaultEmailAddress : emailList.FromAddress);
                        //Start BUSA - 685 :Create an ability to resend an email for Order Approve
                        var emailCCAddressOfFrom    = userProfile.Email;
                        var emailCCAddressOfSupport = sendEmailParameter.FromAddress;
                        if (!string.IsNullOrEmpty(emailCCAddressOfFrom))
                        {
                            sendEmailParameter.CCAddresses.Add(emailCCAddressOfFrom);
                        }
                        if (!string.IsNullOrEmpty(emailCCAddressOfSupport))
                        {
                            sendEmailParameter.CCAddresses.Add(emailCCAddressOfSupport);
                        }
                        //Start BUSA - 685 :Create an ability to resend an email for Order Approve
                        sendEmailParameter.ReplyToAddresses   = new List <string>();
                        sendEmailParameter.ExtendedProperties = new NameValueCollection();
                        SendEmail(sendEmailParameter, unitOfWork);
                    }
                    //BUSA - 489 - end
                }
            }
            catch (Exception ex)
            {
                LogHelper.For((object)this).Error((object)("There was a problem executing UpdateCartResult" + (object)ex.InnerException), ex.InnerException, (string)null, (object)null);
                throw ex;
            }
            return(NextHandler.Execute(unitOfWork, parameter, result));
        }
Exemple #22
0
 public async Task CreateOrEditUsers(UserProfileDto input)
 {
     await _unitOfWork.UserProfiles.CreateOrEditUsers(input);
 }
Exemple #23
0
 public bool UpdatePassword(UserProfileDto user)
 {
     try
     {
         var _user = _userRepository.Get(user.Id);
         var roleId = _userRepository.Get(user.Id).Roles.First().RoleId;
         var currentRole = _roleManager.FindById(roleId).DisplayName;
         var checkPassword = new PasswordHasher().VerifyHashedPassword(_user.Password, user.Password);
         if (checkPassword == PasswordVerificationResult.Success)
         {
             //_user.IsActive = user.IsActive;
             //_user.Name = user.FirstName;
             //_user.Address = user.Address;
             //_user.Surname = user.LastName;
             _user.Password = new PasswordHasher().HashPassword(user.NewPassword);
             _userRepository.Update(_user);
             return true;
         }
         return false;
     }
     catch (Exception ex)
     {
         return false;
     }
 }
 public SetUserProfileAction(UserProfileDto profile) =>