Example #1
0
        public static CustomerDTO CreateNewCustomer(UserSearchDTO connectedAccount = null)
        {
            var dlg = new EditDomainObjectWindow();

            var ctrl = new usrCustomerDetails();

            dlg.SetControl(ctrl);
            var customer = new CustomerDTO();

            customer.Settings         = new CustomerSettingsDTO();
            customer.ConnectedAccount = connectedAccount;
            ctrl.SelectedCustomer     = customer;
            if (dlg.ShowDialog() == true)
            {
                //FillActivities();//TODO:maybe we should change this
                CustomersReposidory.Instance.Add(ctrl.Customer);
                //refresh reminders only if this customer has it
                if (ctrl.Customer.RemindBefore != null)
                {
                    ReminderItemsReposidory.Instance.ClearCache();
                }
                return(ctrl.Customer);
            }
            return(null);
        }
        public StatisticsViewModel(UserSearchDTO user)
        {
            this.user = user;
            addStatistic(ApplicationStrings.UserStatistics_TrainingDaysCountText, user.Statistics.TrainingDaysCount, Achievements.GetTrainingDaysCount(user), Achievements.GetTrainingDaysInfo());
            addStatistic(ApplicationStrings.UserStatistics_WorkoutPlansText, user.Statistics.WorkoutPlansCount, Achievements.GetWorkoutPlansCount(user), Achievements.GetWorkoutPlansInfo());
            addStatistic(ApplicationStrings.UserStatistics_FriendsCountText, user.Statistics.FriendsCount, Achievements.GetFriendsCount(user), Achievements.GetFriendsInfo());
            addStatistic(ApplicationStrings.UserStatistics_FollowersCountText, user.Statistics.FollowersCount, Achievements.GetFollowersCount(user), Achievements.GetFollowersInfo());
            addStatistic(ApplicationStrings.UserStatistics_VotesCountText, user.Statistics.VotingsCount, Achievements.GetVotingsCount(user), Achievements.GetVotingsInfo());
            addStatistic(ApplicationStrings.UserStatistics_BlogCommentsCountText, user.Statistics.TrainingDayCommentsCount, Achievements.GetTrainingDayCommentsCount(user), Achievements.GetBlogCommentsInfo());
            addStatistic(ApplicationStrings.UserStatistics_MyBlogCommentsCount, user.Statistics.MyTrainingDayCommentsCount, Achievements.GetMyTrainingDayCommentsCount(user), Achievements.GetMyBlogCommentsInfo());
            addStatistic(ApplicationStrings.UserStatistics_StrengthTrainingEntriesCount, user.Statistics.StrengthTrainingEntriesCount, Achievements.GetStrengthTrainingEntriesCount(user), Achievements.GetStrengthTrainingEntriesInfo());
            addStatistic(ApplicationStrings.UserStatistics_SizeEntriesCount, user.Statistics.SizeEntriesCount, Achievements.GetSizeEntriesCount(user), Achievements.GetSizeEntriesInfo());
            addStatistic(ApplicationStrings.UserStatistics_SupplementsEntriesCount, user.Statistics.SupplementEntriesCount, Achievements.GetSupplementsEntriesCount(user), Achievements.GetSupplementEntriesInfo());
            addStatistic(ApplicationStrings.UserStatistics_BlogEntriesCount, user.Statistics.BlogEntriesCount, Achievements.GetBlogEntriesCount(user), Achievements.GetBlogEntriesInfo());
            addStatistic(ApplicationStrings.UserStatistics_A6WEntriesCount, user.Statistics.A6WEntriesCount, Achievements.GetA6WEntriesCount(user), Achievements.GetA6WEntriesInfo());
            addStatistic(ApplicationStrings.UserStatistics_A6WFullCyclesCount, user.Statistics.A6WFullCyclesCount, Achievements.GetA6WFullCyclesCount(user), Achievements.GetA6WFullCyclesInfo());
            addStatistic(ApplicationStrings.UserStatistics_SupplementsDefinitionsCount, user.Statistics.SupplementsDefinitionsCount, Achievements.GetSupplementsDefinitionsCount(user), Achievements.GetSupplementsDefinitionsInfo());

            //lvStatistics.Items.Add(string.Format(ApplicationStrings.UserStatistics_LastEntryDateText, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
            //if (user.Statistics.LastEntryDate.HasValue)
            //{
            //    StatisticItemViewModel item = new StatisticItemViewModel();
            //    item.Name = ApplicationStrings.UserStatistics_LastEntryDateText.ToUpper();
            //    item.Value = user.Statistics.LastEntryDate.Value.ToCalendarDate();
            //    Items.Add(item);
            //}
            Items.Sort((a, b) => a.Name.CompareTo(b.Name));
        }
Example #3
0
        void fillAwards(UserSearchDTO user)
        {
            var green  = Achievements.GetGreenStar(user);
            var red    = Achievements.GetRedStar(user);
            var blue   = Achievements.GetBlueStar(user);
            var awards = new ObservableCollection <AwardViewModel>();

            awards.Add(new AwardViewModel(AchievementsHelper.GetWPFIconForRedStar(red), AchievementsHelper.GetStarToolTip(AchievementsHelper.CategorySportName, red)));
            awards.Add(new AwardViewModel(AchievementsHelper.GetWPFIconForBlueStar(blue), AchievementsHelper.GetStarToolTip(AchievementsHelper.CategoryFamousName, blue)));
            awards.Add(new AwardViewModel(AchievementsHelper.GetWPFIconForGreenStar(green), AchievementsHelper.GetStarToolTip(AchievementsHelper.CategorySocialName, green)));


            lstAwards.ItemsSource = awards;
            grAwards.SetVisible(red != AchievementStar.None || blue != AchievementStar.None || green != AchievementStar.None);
            //var blueStar = AchievementsHelper.GetIconForBlueStar(blue);
            //var greenStar = AchievementsHelper.GetIconForGreenStar(green);
            //if (redStar != null || blueStar != null || greenStar != null)
            //{
            //    picRedStar.Image = redStar;
            //    picBlueStar.Image = blueStar;
            //    picBlueStar.Visible = blueStar != null;
            //    picRedStar.Visible = redStar != null;
            //    picGreenStar.Image = greenStar;
            //    picGreenStar.Visible = greenStar != null;
            //    ControlHelper.AddSuperTip(toolTipController1, picGreenStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategorySocialName), green));
            //    ControlHelper.AddSuperTip(toolTipController1, picBlueStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategoryFamousName), blue));
            //    ControlHelper.AddSuperTip(toolTipController1, picRedStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategorySportName), red));
            //    grAwards.Visible = true;
            //}
            //else
            //{
            //    grAwards.Visible = false;
            //}
            //grAwards.SetVisible(Awards.Count > 0);
        }
        public void ReturnsEmptyListIfNoFavouriteVideosSaved()
        {
            var options = DbContextMock.GetOptions("ReturnsEmptyListIfNoFavouriteVideosSaved");

            using (var context = new BubaTubeDbContext(options))
            {
                context.Users.Add(new User()
                {
                    UserName = "******"
                });
                context.SaveChanges();

                var user = context.Users.First();

                var favoutiteVideoService = new FavouriteVideosQueries(context, fakeMapper);
                var userDto = new UserSearchDTO()
                {
                    Id = user.Id
                };

                var result = favoutiteVideoService.GetFavouriteVideos(userDto);

                Assert.Empty(result);
            }
        }
Example #5
0
        /// <summary>
        /// 得到所有模块管理员信息
        /// </summary>
        /// <returns></returns>
        public static ResultData <List <CustomerSysEamilModel> > GetModularList(UserSearchDTO dto)
        {
            ResultData <List <CustomerSysEamilModel> > result = new ResultData <List <CustomerSysEamilModel> >();

            var pp = GetAPI <ResultData <List <UserResultDTO> > >(WebConfiger.MasterDataServicesUrl + "UserManager?UserSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            result.Object = new List <CustomerSysEamilModel>();
            foreach (var p in pp.Object)
            {
                if (p.UserRolelist != null)
                {
                    foreach (var r in p.UserRolelist.Where(ur => ur.Value >= 2 && ur.Value <= 13).ToList())
                    {
                        foreach (var m in ModelRoleModel.ModelRolelist.Where(mr => mr.RoleID == r).Select(s => s.ModelName))
                        {
                            CustomerSysEamilModel cussys = new CustomerSysEamilModel();
                            result.Object.Add(cussys);
                            cussys.UserID   = p.UserID;
                            cussys.FullName = p.FullName;
                            cussys.Email    = p.Email;
                            cussys.Module   = m;
                        }
                    }
                }
            }

            return(result);
        }
        public IEnumerable <UserDetailsDTO> SearchUser(UserSearchDTO searchRequest, ApiContext apiContext)
        {
            _context = (MICAUMContext)DbManager.GetContext(apiContext.ProductType, apiContext.ServerType);
            var _users = _context.TblUserDetails.OrderByDescending(u => u.CreatedDate).Select(x => x);

            if (!string.IsNullOrEmpty(searchRequest.FirstName))
            {
                _users = _users.Where(u => u.FirstName.Contains(searchRequest.FirstName));
            }
            if (!string.IsNullOrEmpty(searchRequest.PanNo))
            {
                _users = _users.Where(u => u.PanNo.Contains(searchRequest.PanNo));
            }
            if (!string.IsNullOrEmpty(searchRequest.EmployeeNumber))
            {
                _users = _users.Where(u => u.EmployeeNumber == searchRequest.EmployeeNumber);
            }
            if (!string.IsNullOrEmpty(searchRequest.EmailId))
            {
                _users = _users.Where(u => u.Email == searchRequest.EmailId);
            }
            if (searchRequest.PartnerId > 0)
            {
                _users = _users.Where(u => u.PartnerId == searchRequest.PartnerId);
            }
            var _usersDTOs = _mapper.Map <List <UserDetailsDTO> >(_users);

            return(_usersDTOs);
        }
Example #7
0
        void fillStatistics(UserSearchDTO user)
        {
            List <StatisticItemViewModel> items = new List <StatisticItemViewModel>();

            if (user.Statistics != null)
            {
                addStatistic(items, string.Format(Strings.UserStatistics_TrainingDaysCountText, user.Statistics.TrainingDaysCount), Achievements.GetTrainingDaysCount(user), Achievements.GetTrainingDaysInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_WorkoutPlansText, user.Statistics.WorkoutPlansCount), Achievements.GetWorkoutPlansCount(user), Achievements.GetWorkoutPlansInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SupplementsDefinitionsText, user.Statistics.WorkoutPlansCount), Achievements.GetSupplementsDefinitionsCount(user), Achievements.GetSupplementsDefinitionsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_FriendsCountText, user.Statistics.FriendsCount), Achievements.GetFriendsCount(user), Achievements.GetFriendsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_FollowersCountText, user.Statistics.FollowersCount), Achievements.GetFollowersCount(user), Achievements.GetFollowersInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_VotesCountText, user.Statistics.VotingsCount), Achievements.GetVotingsCount(user), Achievements.GetVotingsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_BlogCommentsCountText, user.Statistics.TrainingDayCommentsCount), Achievements.GetTrainingDayCommentsCount(user), Achievements.GetBlogCommentsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_MyBlogCommentsCount, user.Statistics.MyTrainingDayCommentsCount), Achievements.GetMyTrainingDayCommentsCount(user), Achievements.GetMyBlogCommentsInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_StrengthTrainingEntriesCount, user.Statistics.StrengthTrainingEntriesCount), Achievements.GetStrengthTrainingEntriesCount(user), Achievements.GetStrengthTrainingEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SizeEntriesCount, user.Statistics.SizeEntriesCount), Achievements.GetSizeEntriesCount(user), Achievements.GetSizeEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_SupplementsEntriesCount, user.Statistics.SupplementEntriesCount), Achievements.GetSupplementsEntriesCount(user), Achievements.GetSupplementEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_BlogEntriesCount, user.Statistics.BlogEntriesCount), Achievements.GetBlogEntriesCount(user), Achievements.GetBlogEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_A6WEntriesCount, user.Statistics.A6WEntriesCount), Achievements.GetA6WEntriesCount(user), Achievements.GetA6WEntriesInfo());
                addStatistic(items, string.Format(Strings.UserStatistics_A6WFullCyclesCount, user.Statistics.A6WFullCyclesCount), Achievements.GetA6WFullCyclesCount(user), Achievements.GetA6WFullCyclesInfo());
                if (user.IsMe() || UserContext.Current.ProfileInformation.Licence.CurrentAccountType == AccountType.Administrator)
                {//show last login date only when we view another user. We user ToCalendar to hide a time of login - we show only the date
                    addStatistic(items, string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
                    //lvStatistics.Items.Add(string.Format(Strings.UserStatistics_LastLoginDate, user.Statistics.LastLoginDate != null ? user.Statistics.LastLoginDate.Value.ToCalendarDate() : string.Empty));
                }
                //lvStatistics.Items.Add(string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
                //addStatistic(items, string.Format(Strings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null ? user.Statistics.LastEntryDate.Value.ToCalendarDate() : string.Empty));
            }
            lvStatistics.ItemsSource = items;
        }
Example #8
0
        void fillAwards(UserSearchDTO user)
        {
            var green     = Achievements.GetGreenStar(user);
            var red       = Achievements.GetRedStar(user);
            var blue      = Achievements.GetBlueStar(user);
            var redStar   = AchievementsHelper.GetIconForRedStar(red);
            var blueStar  = AchievementsHelper.GetIconForBlueStar(blue);
            var greenStar = AchievementsHelper.GetIconForGreenStar(green);

            if (redStar != null || blueStar != null || greenStar != null)
            {
                picRedStar.Image     = redStar;
                picBlueStar.Image    = blueStar;
                picBlueStar.Visible  = blueStar != null;
                picRedStar.Visible   = redStar != null;
                picGreenStar.Image   = greenStar;
                picGreenStar.Visible = greenStar != null;
                ControlHelper.AddSuperTip(toolTipController1, picGreenStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategorySocialName), green));
                ControlHelper.AddSuperTip(toolTipController1, picBlueStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategoryFamousName), blue));
                ControlHelper.AddSuperTip(toolTipController1, picRedStar, null, AchievementsHelper.GetStarToolTip(string.Format("<b>{0}</b>", AchievementsHelper.CategorySportName), red));
                grAwards.Visible = true;
            }
            else
            {
                grAwards.Visible = false;
            }
        }
Example #9
0
 void fillStatistics(UserSearchDTO user)
 {
     lvStatistics.Items.Clear();
     if (user.Statistics != null)
     {
         addStatistic(string.Format(ApplicationStrings.UserStatistics_TrainingDaysCountText, user.Statistics.TrainingDaysCount), Achievements.GetTrainingDaysCount(user), Achievements.GetTrainingDaysInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_WorkoutPlansText, user.Statistics.WorkoutPlansCount), Achievements.GetWorkoutPlansCount(user), Achievements.GetWorkoutPlansInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_FriendsCountText, user.Statistics.FriendsCount), Achievements.GetFriendsCount(user), Achievements.GetFriendsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_FollowersCountText, user.Statistics.FollowersCount), Achievements.GetFollowersCount(user), Achievements.GetFollowersInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_VotesCountText, user.Statistics.VotingsCount), Achievements.GetVotingsCount(user), Achievements.GetVotingsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_BlogCommentsCountText, user.Statistics.BlogCommentsCount), Achievements.GetBlogCommentsCount(user), Achievements.GetBlogCommentsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_MyBlogCommentsCount, user.Statistics.MyBlogCommentsCount), Achievements.GetMyBlogCommentsCount(user), Achievements.GetMyBlogCommentsInfo());
         addStatistic(string.Format(ApplicationStrings.UserStatistics_StrengthTrainingEntriesCount, user.Statistics.StrengthTrainingEntriesCount), Achievements.GetStrengthTrainingEntriesCount(user), Achievements.GetStrengthTrainingEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_SizeEntriesCount, user.Statistics.SizeEntriesCount), Achievements.GetSizeEntriesCount(user), Achievements.GetSizeEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_SupplementsEntriesCount, user.Statistics.SupplementEntriesCount), Achievements.GetSupplementsEntriesCount(user), Achievements.GetSupplementEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_BlogEntriesCount, user.Statistics.BlogEntriesCount), Achievements.GetBlogEntriesCount(user), Achievements.GetBlogEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_A6WEntriesCount, user.Statistics.A6WEntriesCount), Achievements.GetA6WEntriesCount(user), Achievements.GetA6WEntriesInfo());
         addStatistic(string.Format(DomainModelStrings.UserStatistics_A6WFullCyclesCount, user.Statistics.A6WFullCyclesCount), Achievements.GetA6WFullCyclesCount(user), Achievements.GetA6WFullCyclesInfo());
         if (!user.IsMe() && UserContext.CurrentProfile.Role == Role.Administrator)
         {//show last login date only when we view another user. We user ToCalendar to hide a time of login - we show only the date
             lvStatistics.Items.Add(string.Format(DomainModelStrings.UserStatistics_LastLoginDate, user.Statistics.LastLoginDate != null? user.Statistics.LastLoginDate.Value.ToCalendarDate(): string.Empty));
         }
         lvStatistics.Items.Add(string.Format(DomainModelStrings.UserStatistics_LastEntryDate, user.Statistics.LastEntryDate != null? user.Statistics.LastEntryDate.Value.ToCalendarDate(): string.Empty));
     }
 }
Example #10
0
        /// <summary>
        /// 得到所有用户信息(含模糊查询)
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult GetUser(UserSearchDTO dto)
        {
            ResultData <List <UserResultDTO> > result = null;

            result = UserAuthorityProvider.GetUser(dto);

            return(Json(new { total = result.Count, rows = result.Object }, JsonRequestBehavior.AllowGet));
        }
Example #11
0
        /// <summary>
        /// 得到一条启用用户信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static ResultData <UserModel> GetOneEnableUser(UserSearchDTO dto)
        {
            ResultData <UserModel> result = new ResultData <UserModel>();

            result = GetAPI <ResultData <UserModel> >(WebConfiger.MasterDataServicesUrl + "UserManager?id=" + dto.UserID);

            return(result);
        }
Example #12
0
        /// <summary>
        /// 得到启用用户信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static ResultData <List <UserModel> > GetEnableUser(UserSearchDTO dto)
        {
            ResultData <List <UserModel> > result = null;

            result = GetAPI <ResultData <List <UserModel> > >(WebConfiger.MasterDataServicesUrl + "UserManager?UserSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
Example #13
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper stateHelper = new StateHelper(this.State);

            User        = stateHelper.GetValue("User", User);
            viewModel   = new StatisticsViewModel(User);
            DataContext = viewModel;
        }
Example #14
0
        public async Task <ActionResult <PageResult <UserDTO> > > GetListUsersAsync([FromQuery] UserSearchDTO search, int count = 30, int page = 1)
        {
            var result = await userService.GetUsersAsync(search.filter, search.enable, count, page);

            return(new OkObjectResult(new
            {
                result
            }));
        }
Example #15
0
 public static UserSearch UserSearchToDal(UserSearchDTO userSearch)
 {
     return(new UserSearch()
     {
         UserSearchId = userSearch.UserSearchId,
         SearchDate = userSearch.SearchDate,
         Professional = userSearch.Professional,
         UserId = userSearch.UserId
     });
 }
Example #16
0
        public IReadOnlyCollection <VideoDTO> GetFavouriteVideos(UserSearchDTO user)
        {
            var videos = this.context.UserVideo
                         .Where(x => x.UserId == user.Id)
                         .Select(x => x.Video)
                         .Select(this.videoMapper)
                         .ToList();

            return(videos);
        }
Example #17
0
        /// <summary>
        /// 导出用户信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult ExportUser(UserSearchDTO dto)
        {
            string result = null;

            List <UserResultDTO> pp = null;

            dto.page = 1;
            dto.rows = 10000000;
            pp       = UserAuthorityProvider.GetUser(dto).Object;

            string        strTemplateFile = Server.MapPath(@"~/TempLate/UserTemplate.xlsx");
            string        strGenarateDir  = Server.MapPath(@"~/TempFile");
            string        strGenarateFile = Guid.NewGuid().ToString("N") + ".xlsx";
            string        strExportFile   = strGenarateDir + "\\" + strGenarateFile;
            List <object> ratelist        = new List <object>();

            pp.ForEach(g =>
            {
                Models.Model.Excel.ExcelUser er = new Models.Model.Excel.ExcelUser();
                er.状态        = g.IsActivestr;
                er.用户编号      = g.UserCode;
                er.用户名称      = g.FullName;
                er.手机号       = g.PhoneNumber;
                er.邮箱        = g.Email;
                er.角色        = g.UserRoleName;
                er.经销商       = g.UserDistributorstr;
                er.到期日       = g.StopTime != null ? g.StopTime.Value.ToString("yyyy-MM-dd") : "";
                er.停用日期      = g.NoActiveTime != null ? g.NoActiveTime.Value.ToString("yyyy-MM-dd") : "";
                string quanx = "";
                g.UserAuthority.Where(p => p.StructureID.Length == 3).ToList().ForEach(a =>
                {
                    quanx += a.StructureName + "[";
                    g.UserAuthority.Where(p => p.StructureID.Length == 6 && p.StructureID.StartsWith(a.StructureID)).ToList().ForEach(b =>
                    {
                        quanx += b.StructureName + "(";
                        g.UserAuthority.Where(p => p.StructureID.Length == 9 && p.StructureID.StartsWith(b.StructureID)).ToList().ForEach(c =>
                        {
                            quanx += c.StructureName + ",";
                        });
                        quanx += "),";
                    });
                    quanx += "],";
                });
                er.权限 = quanx;

                ratelist.Add(er);
            });

            if (Common.ExcelHelper.Export(strTemplateFile, strGenarateDir, strGenarateFile, ratelist, "Sheet1"))
            {
                result = strGenarateFile;
            }

            return(Json(result));
        }
Example #18
0
        /// <summary>
        /// 查询所有模块信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult GetModularList(UserSearchDTO dto)
        {
            List <CustomerSysEamilModel> result = null;

            dto.RoleIDlist = new List <int?> {
                2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
            };

            result = SystemProvider.GetModularList(dto).Object;

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #19
0
        /// <summary>
        /// 得到所有客户模块管理员人员
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCustomerAdminList()
        {
            UserSearchDTO dto = new UserSearchDTO();

            dto.RoleIDlist = new List <int?>()
            {
                98
            };

            dto.page = 1;
            dto.rows = 10000000;
            ResultData <List <UserResultDTO> > result = null;

            result = UserAuthorityProvider.GetUser(dto);

            return(Json(result.Object, JsonRequestBehavior.AllowGet));
        }
Example #20
0
        public HttpResponseMessage GetUser(string UserSearchDTO)
        {
            UserSearchDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <UserSearchDTO>(UserSearchDTO);
            ResultDTO <List <UserResultDTO> > resultdto = new ResultDTO <List <UserResultDTO> >();
            List <UserResultDTO> user = _lUserAuthorityServices.GetUser(dto);

            resultdto.Object = user;
            resultdto.Count  = dto.Count;
            resultdto.rows   = dto.rows;

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(resultdto),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Example #21
0
 public ActionResult Put(int id, [FromBody] UserSearchDTO value)
 {
     try
     {
         _editUserCommand.Execute(value);
         return(NoContent());
     }catch (AlredyExistException)
     {
         return(StatusCode(422, "Email or Name or Surname or Rolle or Password alredy exist"));
     }
     catch (NotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server error, try later"));
     }
 }
        public void ReturnsListOfFavouriteVideosOfUser()
        {
            var options = DbContextMock.GetOptions("ReturnsListOfFavouriteVideosOfUser");

            using (var context = new BubaTubeDbContext(options))
            {
                context.Users.Add(new User()
                {
                    UserName = "******"
                });
                context.Videos.Add(new Video()
                {
                    Title    = "TestVideo",
                    FileName = "testVideo.mp4",
                    AuthorId = "123"
                });
                context.SaveChanges();

                var user  = context.Users.First();
                var video = context.Videos.First();
                context.UserVideo.Add(new UserVideo()
                {
                    UserId  = user.Id,
                    VideoId = video.Id
                });
                context.SaveChanges();

                var favoutiteVideoService = new FavouriteVideosQueries(context, fakeMapper);
                var userDto = new UserSearchDTO()
                {
                    Id = user.Id
                };

                var result = favoutiteVideoService.GetFavouriteVideos(userDto);

                Assert.NotEmpty(result);
                Assert.Single(result);
                Assert.Equal(video.Title, result.First().Title);
            }
        }
Example #23
0
        /// <summary>
        /// 记录短信登录
        /// </summary>
        /// <param name="PhoneNumber"></param>
        /// <param name="SendContent"></param>
        /// <returns></returns>
        public static bool SaveMessageLog(string PhoneNumber, string SendContent = null)
        {
            bool result = false;

            UserSearchDTO dto = new UserSearchDTO();

            dto.PhoneNumber = PhoneNumber;
            dto.page        = 1;
            dto.rows        = 1;
            var user = UserAuthorityProvider.GetUser(dto);

            List <MessageOperateDTO> msgdtolist = new List <MessageOperateDTO>();

            msgdtolist.Add(new MessageOperateDTO
            {
                UserID      = user.Object.Select(m => m.UserID).FirstOrDefault(),
                SendTime    = DateTime.Now,
                MessageType = 0
            });

            TCSOFT.DMS.WebMain.Models.Provider.CommonProvider.AddMessageStat(msgdtolist);

            return(result);
        }
Example #24
0
        /// <summary>
        /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches
        /// </summary>
        /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="searchDto"></param>
        /// <param name="selectDto"></param>
        /// <returns>Task of ApiResponse (List&lt;RowSearchResult&gt;)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <List <RowSearchResult> > > UserSearchPostSearchAsyncWithHttpInfo(UserSearchDTO searchDto, SelectDTO selectDto)
        {
            // verify the required parameter 'searchDto' is set
            if (searchDto == null)
            {
                throw new ApiException(400, "Missing required parameter 'searchDto' when calling UserSearchApi->UserSearchPostSearch");
            }
            // verify the required parameter 'selectDto' is set
            if (selectDto == null)
            {
                throw new ApiException(400, "Missing required parameter 'selectDto' when calling UserSearchApi->UserSearchPostSearch");
            }

            var    localVarPath         = "/api/UserSearches";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (searchDto != null)
            {
                localVarFormParams.Add("searchDto", this.Configuration.ApiClient.ParameterToString(searchDto));                    // form parameter
            }
            if (selectDto != null)
            {
                localVarFormParams.Add("selectDto", this.Configuration.ApiClient.ParameterToString(selectDto));                    // form parameter
            }
            // authentication (Authorization) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarHeaderParams["Authorization"] = this.Configuration.GetApiKeyWithPrefix("Authorization");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UserSearchPostSearch", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <List <RowSearchResult> >(localVarStatusCode,
                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                             (List <RowSearchResult>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List <RowSearchResult>))));
        }
Example #25
0
        /// <summary>
        /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches
        /// </summary>
        /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="searchDto"></param>
        /// <param name="selectDto"></param>
        /// <returns>Task of List&lt;RowSearchResult&gt;</returns>
        public async System.Threading.Tasks.Task <List <RowSearchResult> > UserSearchPostSearchAsync(UserSearchDTO searchDto, SelectDTO selectDto)
        {
            ApiResponse <List <RowSearchResult> > localVarResponse = await UserSearchPostSearchAsyncWithHttpInfo(searchDto, selectDto);

            return(localVarResponse.Data);
        }
Example #26
0
        /// <summary>
        /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches
        /// </summary>
        /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="searchDto"></param>
        /// <param name="selectDto"></param>
        /// <returns>List&lt;RowSearchResult&gt;</returns>
        public List <RowSearchResult> UserSearchPostSearch(UserSearchDTO searchDto, SelectDTO selectDto)
        {
            ApiResponse <List <RowSearchResult> > localVarResponse = UserSearchPostSearchWithHttpInfo(searchDto, selectDto);

            return(localVarResponse.Data);
        }
Example #27
0
 public UserViewModel(UserSearchDTO user)
 {
     this.user = user;
 }
 public IEnumerable <UserDetailsDTO> SearchUser(UserSearchDTO searchRequest, ApiContext apiContext)
 {
     return(_userproductService(apiContext.ProductType).SearchUser(searchRequest, apiContext));
 }
Example #29
0
        private bool CheckUserInfo(object obj)
        {
            bool             result   = true;
            List <ExcelUser> exceldto = (List <ExcelUser>)obj;
            UserSearchDTO    dto      = new UserSearchDTO();

            dto.rows = 100000000;
            dto.page = 1;
            var UserInfoList            = UserAuthorityProvider.GetUser(dto);
            DistributorSearchDTO disdto = new DistributorSearchDTO();

            disdto.page = 1;
            disdto.rows = 1000000000;
            var           distributorlist = DistributorProvider.GetDistributorList(disdto);//所有经销商
            RoleSearchDTO roleSearch      = new RoleSearchDTO();
            var           rolelist        = UserAuthorityProvider.GetRoleList(roleSearch);
            string        strimporter     = ((UserLoginDTO)Session["UserLoginInfo"]).FullName;

            foreach (var p in exceldto)
            {
                StringBuilder sb = new StringBuilder();
                if (String.IsNullOrEmpty(p.UserCode))
                {
                    sb.Append("用户编号不可为空! ");
                }
                else
                {
                    var UserID = UserInfoList.Object.Where(m => m.UserCode == p.UserCode).Select(m => m.UserID).FirstOrDefault();
                    if (UserID != null)
                    {
                        p.UserID  = UserID;
                        p.UpLogic = 2;
                    }
                    else
                    {
                        p.UpLogic = 1;
                    }
                }
                if (String.IsNullOrEmpty(p.Email))
                {
                    sb.Append("用户邮箱不可为空! ");
                }
                if (String.IsNullOrEmpty(p.PhoneNumber))
                {
                    sb.Append("用户手机号不可为空! ");
                }
                else
                {
                    //手机号在此不做唯一性判断。
                    //var PhoneNumber = UserInfoList.Object.Where(m => m.PhoneNumber == p.PhoneNumber).Select(m => m.PhoneNumber).FirstOrDefault();
                    //if (PhoneNumber != null)
                    //{
                    //    sb.Append("用户手机号不可重复");
                    //}
                }
                if (String.IsNullOrEmpty(p.DistributorNamestr))
                {
                    //sb.Append("所属经销商不可为空!");
                }
                else
                {
                    foreach (var dis in p.DistributorNamelist)
                    {
                        var exist = distributorlist.Object.Where(m => m.DistributorName == dis).FirstOrDefault();
                        if (exist == null)
                        {
                            sb.Append("经销商名称填写错误!错误名称为" + dis + "请检查!");
                        }
                        else
                        {
                        }
                    }
                }
                if (String.IsNullOrEmpty(p.RoleNamestr))
                {
                    //sb.Append("用户角色不可为空! ");
                }
                else
                {
                    foreach (var role in p.RoleNamelist)
                    {
                        var exist = rolelist.Where(m => m.RoleName == role).FirstOrDefault();
                        if (exist == null)
                        {
                            sb.Append("角色" + role + "不存在!");
                        }
                    }
                }
                if (String.IsNullOrEmpty(p.StopTime))
                {
                    sb.Append("使用的截止日期不可为空! ");
                }
                p.Importer = strimporter;
                if (sb.Length > 0)
                {
                    p.CheckInfo = sb.ToString();
                    result      = false;
                }
            }

            return(result);
        }
Example #30
0
        public ProfileInformationDTO GetProfileInformation(Token token, GetProfileInformationCriteria criteria)
        {
            BodyArchitect.Service.V2.InternalBodyArchitectService service = new V2.InternalBodyArchitectService(NHibernateContext.Current().Session);
            V2.Model.Token v2token = new V2.Model.Token(token.SessionId, token.Language);
            V2.Model.GetProfileInformationCriteria v2Crit = new V2.Model.GetProfileInformationCriteria();
            //v2Crit.UserId
            int? tempId;
            Guid?tempGuid;

            if ((tempGuid = h.GetGuidFromInt(criteria)) == null)
            {
                tempGuid = null;
            }
            v2Crit.UserId = tempGuid;
            var res = service.GetProfileInformation(v2token, v2Crit);

            ProfileInformationDTO profile = new ProfileInformationDTO();

            profile.AboutInformation = res.AboutInformation;
            profile.Birthday         = res.Birthday;

            foreach (V2.Model.UserSearchDTO u in res.FavoriteUsers)
            {
                UserSearchDTO a = new UserSearchDTO();
                a.CountryId = u.CountryId;
                //a.CreationDate = u.CreationDate;
                SetProperty(a, "CreationDate", u.CreationDate);
                a.Gender = (BodyArchitect.Service.Model.Gender)u.Gender;
                //a.Id = u.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(u.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.GlobalId.ToString());
                }

                //a.IsDeleted = u.IsDeleted;
                SetProperty(a, "IsDeleted", u.IsDeleted);
                //a.Picture = u.Picture;
                a.Picture = new PictureInfoDTO();
                if (u.Picture != null)
                {
                    a.Picture.Hash      = u.Picture.Hash;
                    a.Picture.PictureId = u.Picture.PictureId;
                    a.Picture.SessionId = u.Picture.SessionId;
                }
                else
                {
                    a.Picture = null;
                }
                a.Privacy.BirthdayDate          = (BodyArchitect.Service.Model.Privacy)u.Privacy.BirthdayDate;
                a.Privacy.CalendarView          = (BodyArchitect.Service.Model.Privacy)u.Privacy.CalendarView;
                a.Privacy.Friends               = (BodyArchitect.Service.Model.Privacy)u.Privacy.Friends;
                a.Privacy.Searchable            = u.Privacy.Searchable;
                a.Privacy.Sizes                 = (BodyArchitect.Service.Model.Privacy)u.Privacy.Sizes;
                a.Statistics.A6WEntriesCount    = u.Statistics.A6WEntriesCount;
                a.Statistics.A6WFullCyclesCount = u.Statistics.A6WFullCyclesCount;
                a.Statistics.BlogCommentsCount  = u.Statistics.TrainingDayCommentsCount;
                a.Statistics.BlogEntriesCount   = u.Statistics.BlogEntriesCount;
                a.Statistics.FollowersCount     = u.Statistics.FollowersCount;
                a.Statistics.FriendsCount       = u.Statistics.FriendsCount;
                //a.Statistics.Id
                if ((tempId = h.GetIntFromGuid(u.Statistics.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u.Statistics);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.Statistics.GlobalId.ToString());
                }
                //a.Statistics.IsNew
                a.Statistics.LastEntryDate                = u.Statistics.LastEntryDate;
                a.Statistics.LastLoginDate                = u.Statistics.LastLoginDate;
                a.Statistics.LoginsCount                  = u.Statistics.LoginsCount;
                a.Statistics.MyBlogCommentsCount          = u.Statistics.MyTrainingDayCommentsCount;
                a.Statistics.SizeEntriesCount             = u.Statistics.SizeEntriesCount;
                a.Statistics.StrengthTrainingEntriesCount = u.Statistics.StrengthTrainingEntriesCount;
                a.Statistics.SupplementEntriesCount       = u.Statistics.SupplementEntriesCount;
                a.Statistics.Tag = u.Statistics.Tag;
                a.Statistics.TrainingDaysCount = u.Statistics.TrainingDaysCount;
                a.Statistics.VotingsCount      = u.Statistics.VotingsCount;
                a.Statistics.WorkoutPlansCount = u.Statistics.WorkoutPlansCount;
                a.UserName = u.UserName;
                profile.FavoriteUsers.Add(a);
            }


            //profile.Friends = res.Friends;
            foreach (V2.Model.UserSearchDTO u in res.Friends)
            {
                UserSearchDTO a = new UserSearchDTO();
                a.CountryId = u.CountryId;
                //a.CreationDate = u.CreationDate;
                SetProperty(a, "CreationDate", u.CreationDate);
                a.Gender = (BodyArchitect.Service.Model.Gender)u.Gender;
                //a.Id = u.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(u.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.GlobalId.ToString());
                }

                //a.IsDeleted = u.IsDeleted;
                SetProperty(a, "IsDeleted", u.IsDeleted);
                //a.Picture = u.Picture;
                a.Picture = new PictureInfoDTO();
                if (u.Picture != null)
                {
                    a.Picture.Hash      = u.Picture.Hash;
                    a.Picture.PictureId = u.Picture.PictureId;
                    a.Picture.SessionId = u.Picture.SessionId;
                }
                else
                {
                    a.Picture = null;
                }
                a.Privacy.BirthdayDate          = (BodyArchitect.Service.Model.Privacy)u.Privacy.BirthdayDate;
                a.Privacy.CalendarView          = (BodyArchitect.Service.Model.Privacy)u.Privacy.CalendarView;
                a.Privacy.Friends               = (BodyArchitect.Service.Model.Privacy)u.Privacy.Friends;
                a.Privacy.Searchable            = u.Privacy.Searchable;
                a.Privacy.Sizes                 = (BodyArchitect.Service.Model.Privacy)u.Privacy.Sizes;
                a.Statistics.A6WEntriesCount    = u.Statistics.A6WEntriesCount;
                a.Statistics.A6WFullCyclesCount = u.Statistics.A6WFullCyclesCount;
                a.Statistics.BlogCommentsCount  = u.Statistics.TrainingDayCommentsCount;
                a.Statistics.BlogEntriesCount   = u.Statistics.BlogEntriesCount;
                a.Statistics.FollowersCount     = u.Statistics.FollowersCount;
                a.Statistics.FriendsCount       = u.Statistics.FriendsCount;
                //a.Statistics.Id
                if ((tempId = h.GetIntFromGuid(u.Statistics.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(u.Statistics);
                }
                if (tempId != null)
                {
                    a.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", u.Statistics.GlobalId.ToString());
                }
                //a.Statistics.IsNew
                a.Statistics.LastEntryDate                = u.Statistics.LastEntryDate;
                a.Statistics.LastLoginDate                = u.Statistics.LastLoginDate;
                a.Statistics.LoginsCount                  = u.Statistics.LoginsCount;
                a.Statistics.MyBlogCommentsCount          = u.Statistics.MyTrainingDayCommentsCount;
                a.Statistics.SizeEntriesCount             = u.Statistics.SizeEntriesCount;
                a.Statistics.StrengthTrainingEntriesCount = u.Statistics.StrengthTrainingEntriesCount;
                a.Statistics.SupplementEntriesCount       = u.Statistics.SupplementEntriesCount;
                a.Statistics.Tag = u.Statistics.Tag;
                a.Statistics.TrainingDaysCount = u.Statistics.TrainingDaysCount;
                a.Statistics.VotingsCount      = u.Statistics.VotingsCount;
                a.Statistics.WorkoutPlansCount = u.Statistics.WorkoutPlansCount;
                a.UserName = u.UserName;
                profile.FavoriteUsers.Add(a);
            }

            //profile.Invitations =  res.Invitations;
            foreach (V2.Model.FriendInvitationDTO c in res.Invitations)
            {
                Model.FriendInvitationDTO a = new FriendInvitationDTO();
                a.CreatedDateTime   = c.CreatedDateTime;
                a.InvitationType    = (BodyArchitect.Service.Model.InvitationType)c.InvitationType;
                a.Invited.CountryId = c.Invited.CountryId;
                //a.Invited.Id
                SetProperty(a.Invited, "CreationDate", c.Invited.CreationDate);
                a.Invited.Gender = (BodyArchitect.Service.Model.Gender)c.Invited.Gender;
                //a.Id = c.Invited.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(c.Invited.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(c.Invited);
                }
                if (tempId != null)
                {
                    a.Invited.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", c.Invited.GlobalId.ToString());
                }

                //a.IsDeleted = c.Invited.IsDeleted;
                SetProperty(a.Invited, "IsDeleted", c.Invited.IsDeleted);
                //a.Picture = c.Invited.Picture;
                a.Invited.Picture = new PictureInfoDTO();
                if (c.Invited.Picture != null)
                {
                    a.Invited.Picture.Hash      = c.Invited.Picture.Hash;
                    a.Invited.Picture.PictureId = c.Invited.Picture.PictureId;
                    a.Invited.Picture.SessionId = c.Invited.Picture.SessionId;
                }
                else
                {
                    a.Invited.Picture = null;
                }
                a.Invited.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.BirthdayDate;
                a.Invited.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.CalendarView;
                a.Invited.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.Friends;
                a.Invited.Privacy.Searchable   = c.Invited.Privacy.Searchable;
                a.Invited.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)c.Invited.Privacy.Sizes;
                a.Invited.UserName             = c.Invited.UserName;



                a.Inviter.CountryId = c.Inviter.CountryId;
                //a.Inviter.Id
                SetProperty(a.Inviter, "CreationDate", c.Inviter.CreationDate);
                a.Inviter.Gender = (BodyArchitect.Service.Model.Gender)c.Inviter.Gender;
                //a.Id = c.Inviter.GlobalId;
                tempId = null;
                if ((tempId = h.GetIntFromGuid(c.Inviter.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(c.Inviter);
                }
                if (tempId != null)
                {
                    a.Inviter.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", c.Inviter.GlobalId.ToString());
                }

                //a.IsDeleted = c.Inviter.IsDeleted;
                SetProperty(a.Inviter, "IsDeleted", c.Inviter.IsDeleted);
                //a.Picture = c.Inviter.Picture;
                a.Inviter.Picture = new PictureInfoDTO();
                if (c.Inviter.Picture != null)
                {
                    a.Inviter.Picture.Hash      = c.Inviter.Picture.Hash;
                    a.Inviter.Picture.PictureId = c.Inviter.Picture.PictureId;
                    a.Inviter.Picture.SessionId = c.Inviter.Picture.SessionId;
                }
                else
                {
                    a.Inviter.Picture = null;
                }
                a.Inviter.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.BirthdayDate;
                a.Inviter.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.CalendarView;
                a.Inviter.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.Friends;
                a.Inviter.Privacy.Searchable   = c.Inviter.Privacy.Searchable;
                a.Inviter.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)c.Inviter.Privacy.Sizes;
                a.Inviter.UserName             = c.Inviter.UserName;

                a.Message = c.Message;
                profile.Invitations.Add(a);
            }


            profile.IsActivated       = res.IsActivated;
            profile.LastLogin         = res.LastLogin;
            profile.Messages          = null; //?
            profile.RetrievedDateTime = res.RetrievedDateTime;
            //profile.Settings = res.Settings;

            profile.Settings = new ProfileSettingsDTO();
            tempId           = null;
            if ((tempId = h.GetIntFromGuid(res.Settings.GlobalId)) == null)
            {
                tempId = h.SetIntFromGuid(res.Settings);
            }
            if (tempId != null)
            {
                profile.Settings.Id = (int)tempId;
            }
            else
            {
                throw new ArgumentException("Id not assigned to guid", res.Settings.GlobalId.ToString());
            }
            //profile.Role = res.Profile.
            profile.Settings.AutomaticUpdateMeasurements = res.Settings.AutomaticUpdateMeasurements;
            //profile.Settings.Id = res.Profile.Settings.GlobalId;

            //SetProperty(profile.Settings, "IsNew", res.Profile.Settings.IsNew);
            //profile.Settings.IsNew = res.Profile.Settings.IsNew;
            //TODO:check notifications
            profile.Settings.NotificationBlogCommentAdded      = res.Settings.NotificationBlogCommentAdded != BodyArchitect.Service.V2.Model.ProfileNotification.None;
            profile.Settings.NotificationExerciseVoted         = res.Settings.NotificationVoted != BodyArchitect.Service.V2.Model.ProfileNotification.None; //??
            profile.Settings.NotificationFriendChangedCalendar = res.Settings.NotificationFriendChangedCalendar != BodyArchitect.Service.V2.Model.ProfileNotification.None;
            profile.Settings.NotificationWorkoutPlanVoted      = res.Settings.NotificationVoted != BodyArchitect.Service.V2.Model.ProfileNotification.None; //??

            profile.User           = new UserSearchDTO();
            profile.User.CountryId = res.User.CountryId;
            SetProperty(profile.User, "CreationDate", res.User.CreationDate);
            profile.User.Gender = (BodyArchitect.Service.Model.Gender)res.User.Gender;
            //a.Id = res.User.GlobalId;
            tempId = null;
            if ((tempId = h.GetIntFromGuid(res.User.GlobalId)) == null)
            {
                tempId = h.SetIntFromGuid(res.User);
            }
            if (tempId != null)
            {
                profile.User.Id = (int)tempId;
            }
            else
            {
                throw new ArgumentException("Id not assigned to guid", res.User.GlobalId.ToString());
            }

            //a.IsDeleted = res.User.IsDeleted;
            SetProperty(profile.User, "IsDeleted", res.User.IsDeleted);
            //a.Picture = res.User.Picture;
            profile.User.Picture = new PictureInfoDTO();
            if (res.User.Picture != null)
            {
                profile.User.Picture.Hash      = res.User.Picture.Hash;
                profile.User.Picture.PictureId = res.User.Picture.PictureId;
                profile.User.Picture.SessionId = res.User.Picture.SessionId;
            }
            else
            {
                profile.User.Picture = null;
            }
            profile.User.Privacy.BirthdayDate = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.BirthdayDate;
            profile.User.Privacy.CalendarView = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.CalendarView;
            profile.User.Privacy.Friends      = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.Friends;
            profile.User.Privacy.Searchable   = res.User.Privacy.Searchable;
            profile.User.Privacy.Sizes        = (BodyArchitect.Service.Model.Privacy)res.User.Privacy.Sizes;
            profile.User.UserName             = res.User.UserName;


            profile.Wymiary = new WymiaryDTO();
            if (res.Wymiary != null)
            {
                profile.Wymiary.DateTime = res.Wymiary.Time.DateTime;

                profile.Wymiary.Height = (int)res.Wymiary.Height;   //possible loss of data
                tempId = null;
                if ((tempId = h.GetIntFromGuid(res.Wymiary.GlobalId)) == null)
                {
                    tempId = h.SetIntFromGuid(res.Wymiary);
                }
                if (tempId != null)
                {
                    profile.Wymiary.Id = (int)tempId;
                }
                else
                {
                    throw new ArgumentException("Id not assigned to guid", res.Wymiary.GlobalId.ToString());
                }
                //profile.Wymiary.IsEmpty = res.Wymiary.IsEmpty; //READ ONLY
                profile.Wymiary.IsNaCzczo = false;  //res.Wymiary.????
                //profile.Wymiary.IsNew = res.Wymiary.IsNew;    //READ ONLY
                profile.Wymiary.Klatka       = (float)res.Wymiary.Klatka;
                profile.Wymiary.LeftBiceps   = (float)res.Wymiary.LeftBiceps;
                profile.Wymiary.LeftForearm  = (float)res.Wymiary.LeftForearm;
                profile.Wymiary.LeftUdo      = (float)res.Wymiary.LeftUdo;
                profile.Wymiary.Pas          = (float)res.Wymiary.Pas;
                profile.Wymiary.RightBiceps  = (float)res.Wymiary.RightBiceps;
                profile.Wymiary.RightForearm = (float)res.Wymiary.RightForearm;
                profile.Wymiary.RightUdo     = (float)res.Wymiary.RightUdo;
                profile.Wymiary.Tag          = res.Wymiary.Tag;
                profile.Wymiary.Weight       = (float)res.Wymiary.Weight;
            }
            return(profile);
        }