/// <summary>
    /// Event after file uploaded.
    /// </summary>
    /// <param name="sender">Object ccAsyncFileUpload.</param>
    /// <param name="e">AsyncFileUploadEventArgs e.</param>
    protected void OnAsyncFileUploadedComplete(Object sender, AsyncFileUploadEventArgs e)
    {
        AsyncFileUpload afu = (AsyncFileUpload)sender;

        if (afu.HasFile)
        {
            String fileExtension = Path.GetExtension(afu.PostedFile.FileName).ToLower();

            // Check max uploaded file size.
            if (afu.PostedFile.ContentLength > _defaultUploadLimit)
            {
                // File size limit exceeded (_defaultUploadLimit/1048576 Mb);
            }
            else if (this.allowedFileExtensions.Contains(fileExtension))
            {
                // Make file path string.
                String destDir  = Server.MapPath(Constants._defaultPhotoPath);
                String keyName  = this._userID.ToString();
                String destPath = Path.Combine(destDir, String.Concat(keyName, fileExtension));

                // Save photo-file on server.
                afu.PostedFile.SaveAs(destPath);

                // Save photo-path in database.
                PersonalInfoRepository.ModifyAvatar(
                    this._userID, String.Concat(keyName, fileExtension));
            }
        }
    }
Example #2
0
    /// <summary>
    /// After dvUserInfo data binding.
    /// </summary>
    /// <param name="sender">Object sender : dvUserInfo.</param>
    /// <param name="e">EventArgs e.</param>
    protected void OnUserInfoDataBound(Object sender, EventArgs e)
    {
        Address      address      = AddressRepository.GetUserAddress(this._userID);
        PersonalInfo personalInfo = PersonalInfoRepository.GetUserInfo(this._userID);

        #region // Inner controls
        Label lblBirthday  = dvUserInfo.FindControl("lblBirthday") as Label;
        Label lblPhone     = dvUserInfo.FindControl("lblPhone") as Label;
        Label lblSex       = dvUserInfo.FindControl("lblSex") as Label;
        Label lblCountry   = dvUserInfo.FindControl("lblCountry") as Label;
        Label lblCity      = dvUserInfo.FindControl("lblCity") as Label;
        Label lblArea      = dvUserInfo.FindControl("lblArea") as Label;
        Label lblStreet    = dvUserInfo.FindControl("lblStreet") as Label;
        Label lblHome      = dvUserInfo.FindControl("lblHome") as Label;
        Label lblApartment = dvUserInfo.FindControl("lblApartment") as Label;
        #endregion

        imgUserAvatar.ImageUrl = personalInfo.ImagePath;
        if (this.imgUserAvatar.ImageUrl == Constants._defaultAvatarImage)
        {
            this.imgUserAvatar.ImageUrl = String.Concat(Constants._defaultPhotoPath, Constants._defaultAvatarImage);
        }
        else
        {
            this.imgUserAvatar.ImageUrl = String.Concat(Constants._defaultPhotoPath, imgUserAvatar.ImageUrl);
        }

        // If user have address -> set values to controls.
        if (address != null)
        {
            this.SetValueOrInvisible(
                this.dvUserInfo,
                0,
                lblBirthday,
                String.Format("{0:" + Constants._dateFormat + "}", personalInfo.Birthday));

            if (this.SetValueOrInvisible(this.dvUserInfo, 1, lblSex, personalInfo.Sex.ToString()))
            {
                lblSex.Text = EnumsHelper.ToString((Sex)Convert.ToInt32(lblSex.Text));
            }
            this.SetValueOrInvisible(this.dvUserInfo, 2, lblPhone, personalInfo.Phone);
            Guid?countryID = address.CountryID;
            if (countryID != null)
            {
                this.SetValueOrInvisible(
                    this.dvUserInfo, 3, lblCountry, AddressRepository.GetCountryName((Guid)countryID));
            }
            Guid?cityID = address.CityID;
            if (cityID != null)
            {
                this.SetValueOrInvisible(
                    this.dvUserInfo, 4, lblCity, AddressRepository.GetCityName((Guid)cityID));
            }
            this.SetValueOrInvisible(this.dvUserInfo, 5, lblArea, address.Area);
            this.SetValueOrInvisible(this.dvUserInfo, 6, lblStreet, address.Street);
            this.SetValueOrInvisible(this.dvUserInfo, 7, lblHome, address.Home);
            this.SetValueOrInvisible(this.dvUserInfo, 8, lblApartment, address.Apartment);
        }
    }
Example #3
0
 private void FillMessageInfo(RepeaterItem item, LinkButton btnUserName)
 {
     if (btnUserName != null)
     {
         PersonalInfo person = PersonalInfoRepository.GetUserInfo(Guid.Parse(btnUserName.Text));
         btnUserName.Text = String.Join(" ", person.FirstName, person.LastName);
     }
 }
Example #4
0
 public ExperienceData(VisitsRepository visitsRepository, PersonalInfoRepository personalInfoRepository, OnsiteBehaviorRepository onsiteBehaviorRepository, ReferralRepository referralRepository, ITrackerService trackerService)
 {
     this.Visits         = visitsRepository.Get();
     this.PersonalInfo   = personalInfoRepository.Get();
     this.OnsiteBehavior = onsiteBehaviorRepository.Get();
     this.Referral       = referralRepository.Get();
     this.IsActive       = trackerService.IsActive;
 }
    /// <summary>
    /// Save changes in main settings.
    /// </summary>
    /// <param name="sender">Object sender : fvMain.</param>
    /// <param name="e">FormViewUpdateEventArgs e.</param>
    protected void OnMainItemUpdating(Object sender, FormViewUpdateEventArgs e)
    {
        #region Inner controls
        TextBox      tbxNickName    = fvMain.FindControl("tbxNickName") as TextBox;
        TextBox      tbxFirstName   = fvMain.FindControl("tbxFirstName") as TextBox;
        TextBox      tbxLastName    = fvMain.FindControl("tbxLastName") as TextBox;
        TextBox      tbxMiddleName  = fvMain.FindControl("tbxMiddleName") as TextBox;
        TextBox      tbxPhone       = fvMain.FindControl("tbxPhone") as TextBox;
        TextBox      tbxBirthday    = fvMain.FindControl("tbxBirthday") as TextBox;
        TextBox      tbxDescription = fvMain.FindControl("tbxDescription") as TextBox;
        DropDownList ddlSex         = fvMain.FindControl("ddlSex") as DropDownList;
        #endregion

        DateTime birthday;
        DateTime?vBirthday = null;

        // Convert date to default date format.
        if (DateTime.TryParseExact(
                tbxBirthday.Text,
                Constants._dateFormat,
                CultureInfo.InvariantCulture,
                DateTimeStyles.None,
                out birthday))
        {
            vBirthday = birthday;
        }

        Sex   sex  = new Sex();
        Sex?  vSex = null;
        Int32 ddlSexSelectedValue;
        if (Int32.TryParse(ddlSex.SelectedValue, out ddlSexSelectedValue))
        {
            if (Enum.TryParse(
                    Enum.GetName(
                        typeof(Sex),
                        Convert.ToInt32(ddlSex.SelectedValue)),
                    out sex))
            {
                vSex = sex;
            }
        }

        PersonalInfoRepository.ModifyPersonalInfo(
            null,
            true,
            false,
            this._userID,
            tbxNickName.Text.Trim(),
            tbxFirstName.Text.Trim(),
            tbxLastName.Text.Trim(),
            tbxMiddleName.Text.Trim(),
            vSex,
            tbxPhone.Text.Trim(),
            vBirthday,
            null,
            tbxDescription.Text.Trim());
    }
Example #6
0
 /// <summary>
 /// Gridview row data bound event.
 /// </summary>
 /// <param name="sender">Object sender.</param>
 /// <param name="e">EventArgs e.</param>
 protected void gvBans_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         HyperLink hl = e.Row.FindControl("hlUserPage") as HyperLink;
         hl.Text        = PersonalInfoRepository.GetFullName(new Guid(e.Row.Cells[0].Text));
         hl.NavigateUrl = "~/UserProfile.aspx?id=" + e.Row.Cells[0].Text;
     }
 }
Example #7
0
        public List <KeyValuePair <Guid, String> > GetAllFriends(Guid userID)
        {
            var friendList = FriendRepository.GetUserFriends(userID);

            return(friendList
                   .Select(s => new KeyValuePair <Guid, String>(
                               s.FriendID,
                               PersonalInfoRepository.GetUserInfo(s.FriendID).LastName)).ToList());
        }
        public void ModifyMainUserInfo(
            String nickName,
            String firstName,
            String lastName,
            String middleName,
            String sex,
            String phone,
            String birthday,
            String description)
        {
            HttpContext.Current.Session["_userID"] = "e80cd2ac-8517-4e95-8321-3f4593d2106a";

            Guid userID = Guid.Empty;

            if (Guid.TryParse((String)Session["_userID"], out userID))
            {
                if (userID != Guid.Empty)
                {
                    DateTime?vBirthday = new DateTime?();
                    try
                    {
                        vBirthday = Convert.ToDateTime(birthday);
                    }
                    catch (Exception ex)
                    {
                        vBirthday = null;
                    }

                    Sex vGender = new Sex();
                    Sex?vSex    = new Sex?();
                    if (Enum.TryParse(Enum.GetName(typeof(Sex), Convert.ToInt32(sex)), out vGender))
                    {
                        vSex = vGender;
                    }
                    else
                    {
                        vSex = null;
                    }

                    PersonalInfoRepository.ModifyPersonalInfo(
                        null,
                        true,
                        false,
                        userID,
                        nickName,
                        firstName,
                        lastName,
                        middleName,
                        vSex,
                        phone,
                        vBirthday,
                        null,
                        description);
                }
            }
        }
Example #9
0
        public ExperienceData(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider)
        {
            this.contactProfileProvider = contactProfileProvider;
            this.profileProvider        = profileProvider;

            Visits         = new VisitsRepository(contactProfileProvider).Get();
            PersonalInfo   = new PersonalInfoRepository(contactProfileProvider).Get();
            OnsiteBehavior = new OnsiteBehaviorRepository(profileProvider).Get();
            Referral       = new ReferralRepository().Get();
        }
 public void TestInitialize()
 {
     mTaxesAndWrapUpRepository = new TaxesAndWrapUpRepository();
     mPersonalInfoRepository   = new PersonalInfoRepository();
     mW2Repository             = new W2Repository();
     mInterestIncomeRepository = new InterestIncomeRepository();
     mUnemploymentRepository   = new UnemploymentRepository();
     mUserData      = new ExpandoObject();
     mUserId        = IT_UserRepository.PersistNewUser();
     mTaxReturnData = new TaxReturnData();
 }
Example #11
0
    /// <summary>
    /// Bind data to wallboard.
    /// </summary>
    /// <param name="sender">Object sender : GridView.</param>
    /// <param name="e">GridViewRowEventArgs e.</param>
    protected void OnWallRowDataBound(Object sender, GridViewRowEventArgs e)
    {
        GridViewRow grdRowItem = e.Row;

        // Get user names on wallboard by id.
        Label        lblFromID    = grdRowItem.FindControl("lblFromID") as Label;
        PersonalInfo personalInfo = PersonalInfoRepository.GetUserInfo(this._userID);

        if (lblFromID != null && personalInfo != null)
        {
            Guid fromID = Guid.Parse(lblFromID.Text);
            lblFromID.Text = String.Join(" ", personalInfo.FirstName, personalInfo.LastName);
        }
    }
Example #12
0
        private FrontPageViewModel GetFrontPageViewModel(PageViewMode?mode)
        {
            var repo         = new PersonalInfoRepository();
            var personalInfo = repo.GetPersonalInfo();

            var eduRepo    = new EducationRepository();
            var educations = eduRepo.GetEducations();

            var expRepo    = new WorkExperienceRepository();
            var experience = expRepo.GetWorkExperience();

            var skillsRepo = new SkillsRepository();
            var skills     = skillsRepo.GetSkills();

            ViewBag.Mode = mode ?? PageViewMode.View;

            var frontPageViewModel = new FrontPageViewModel()
            {
                EducationBlock = new EducationListViewModel()
                {
                    NewEducation = new EducationViewModel()
                },
                WorkExperienceBlock = new WorkExperienceListViewModel()
                {
                    NewWorkExpirience = new WorkExperienceViewModel()
                },
                SkillCategoryBlock = new SkillsCategoryListViewModel()
                {
                    NewSkillCategory = new SkillsCategoryViewModel(),
                }
            };

            frontPageViewModel.PersonalInfo = new PersonalInfoViewModel(personalInfo);

            frontPageViewModel.EducationBlock.EducationList = educations.Select(x => new EducationViewModel(x)).ToList();
            frontPageViewModel.EducationBlock.NewEducation  = new EducationViewModel();

            frontPageViewModel.WorkExperienceBlock.WorkExperienceList = experience.Select(x => new WorkExperienceViewModel(x)).ToList();
            frontPageViewModel.WorkExperienceBlock.NewWorkExpirience  = new WorkExperienceViewModel();

            frontPageViewModel.SkillCategoryBlock.SkillsCategoryList = skills.Select(x => new SkillsCategoryViewModel(x)).ToList();
            frontPageViewModel.SkillCategoryBlock.NewSkillCategory   = new SkillsCategoryViewModel();

            return(frontPageViewModel);
        }
        public String GetUploadedAvatarImage(Guid?id = null)
        {
            HttpContext.Current.Session["_userID"] = "e80cd2ac-8517-4e95-8321-3f4593d2106a";

            //Guid userID = (id == null) ? Guid.Empty : (Guid)id;

            Guid userID = (id == Guid.Empty) ? Guid.Empty : (Guid)id;

            if (userID == Guid.Empty)
            {
                if (Guid.TryParse((String)Session["_userID"], out userID))
                {
                    return(PersonalInfoRepository.GetUserInfo(userID).ImagePath);
                }
            }
            else
            {
                return(PersonalInfoRepository.GetUserInfo(userID).ImagePath);
            }

            return(_defaultAvatarImage);
        }
Example #14
0
 /// <summary>
 /// PageLoad event handler.
 /// </summary>
 /// <param name="sender">Object sender.</param>
 /// <param name="e">EventArgs e.</param>
 protected void Page_Load(Object sender, EventArgs e)
 {
     Guid.TryParse("e80cd2ac-8517-4e95-8321-3f4593d2106a", out this._userID);
     if (!Page.IsPostBack)
     {
         PersonalInfo personalInfo = PersonalInfoRepository.GetUserInfo(this._userID);
         fvMain.DataSource = new List <PersonalInfo> {
             personalInfo
         };
         fvAddress.DataSource = new List <Address> {
             AddressRepository.GetUserAddress(this._userID)
         };
         imgAvatar.ImageUrl = personalInfo.ImagePath;
         if (this.imgAvatar.ImageUrl == Constants._defaultAvatarImage)
         {
             imgAvatar.ImageUrl = String.Concat(Constants._defaultPhotoPath, Constants._defaultAvatarImage);
         }
         else
         {
             this.imgAvatar.ImageUrl = String.Concat(Constants._defaultPhotoPath, imgAvatar.ImageUrl);
         }
         Page.DataBind();
     }
 }
Example #15
0
        //public String UserPhoto
        //{
        //    set { lblFio.Text = value; }
        //}

        /// <summary>
        /// Page load event.
        /// </summary>
        /// <param name="sender">Object sender.</param>
        /// <param name="e">Eventargs e.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            UserName   = PersonalInfoRepository.GetFullName(this.FriendID);
            UserStatus = StatusRepository.GetStatusMessage(this.FriendID);
        }
Example #16
0
    /// <summary>
    /// Page_Load event.
    /// </summary>
    /// <param name="sender">Object sender.</param>
    /// <param name="e">EventArgs e.</param>
    protected void Page_Load(Object sender, EventArgs e)
    {
        if (!SessionHelper.IsAuthenticated)
        {
            Response.Redirect("~/Login.aspx");
        }
        this._userID = new Guid(Request.QueryString["id"].ToString());
        if (_userID != SessionHelper.UserID)
        {
            //invisible and visible needled things...
        }
        if (SessionHelper.IsModerator)
        {
            //visible needled things
            Button btnBan = (Button)Master.FindControl("btnBan");
            btnBan.Visible = true;
        }
        if (SessionHelper.IsAdmin)
        {
            //visible needled things
            Label lblEmail = (Label)Master.FindControl("lblEmail");
            lblEmail.Text    = (UserRepository.GetUserInfo(this._userID)).Email;
            lblEmail.Visible = true;
            ImageButton btnBan = (ImageButton)Master.FindControl("btnBan");
            btnBan.Visible = true;
            ImageButton btnAdmin = (ImageButton)Master.FindControl("btnAdmin");
            btnAdmin.Visible = true;
        }
        // Тут должен быть идентификатор текущего пользователя
        this._userID = new Guid(Request.QueryString["id"].ToString());
        //Guid.Parse("e80cd2ac-8517-4e95-8321-3f4593d2106a");

        if (!Page.IsPostBack)
        {
            // Set user name and status on the top of table.
            PersonalInfo personalInfo = PersonalInfoRepository.GetUserInfo(this._userID);
            if (personalInfo != null)
            {
                dvUserInfo.DataSource = new List <PersonalInfo> {
                    personalInfo
                };
                lblHeadUserName.Text   = String.Join(" ", personalInfo.FirstName, personalInfo.LastName);
                lblHeadUserStatus.Text = EnumsHelper.ToString(((UserStatus)StatusRepository.GetStatusID(this._userID)));

                // Show user full name.
                lblUserName.Text = String.Join(
                    " ",
                    personalInfo.FirstName,
                    personalInfo.LastName,
                    personalInfo.MiddleName,
                    personalInfo.NickName);

                // Show status message.
                btnStatusMessage.Text = StatusRepository.GetStatusMessage(this._userID);
                if (btnStatusMessage.Text == String.Empty)
                {
                    btnStatusMessage.Text = _defaultEmptyStatusMessage;
                }
            }

            // Bind data to wallboard.
            IEnumerable <WallBoardItem> dsWallBoardItem = WallBoardItemRepository.GetUserWallboardItems(this._userID);
            fvWall.DataSource  = dsWallBoardItem;
            grdWall.DataSource = dsWallBoardItem;

            // Bind all page data elements.
            Page.DataBind();
        }

        // Set invisible mode to status change panel on postback.
        if (Page.IsPostBack)
        {
            this.StatusPanelEditMode(false);
        }
    }