コード例 #1
0
ファイル: AddUser.ascx.cs プロジェクト: elshiekh5/Giras
    //-----------------------------------------------
    #endregion
    //-------------------------------------------------------
    #region ---------------CreateUserProfile---------------
    //-----------------------------------------------
    //CreateUserProfile
    //-----------------------------------------------
    protected bool CreateUserProfile(MembershipUser user, out UsersDataEntity usersDataObject)
    {
        usersDataObject = new UsersDataEntity();
        string uploadedPhotoExtension = Path.GetExtension(fuPhoto.FileName);

        usersDataObject.UserId = (Guid)user.ProviderUserKey;
        usersDataObject.Name   = txtName.Text;
        if (currentModule.CategoryLevel != 0)
        {
            usersDataObject.CategoryID = Convert.ToInt32(ddlCategoryID.SelectedValue);
        }
        if (trEmpNo.Visible && !string.IsNullOrEmpty(txtEmpNo.Text))
        {
            usersDataObject.EmpNo = Convert.ToInt32(txtEmpNo.Text);
        }
        //------------------------------------------------------------
        if (trAgeRang.Visible)
        {
            usersDataObject.AgeRang = Convert.ToInt32(ddlAgeRang.SelectedValue);
        }
        if (trGender.Visible)
        {
            usersDataObject.Gender = (Gender)Convert.ToInt32(ddlGender.SelectedValue);
        }
        if (trBirthDate.Visible)
        {
            usersDataObject.BirthDate = ucDateBirthDate.Date.ToShortDateString();
        }
        if (trSocialStatus.Visible)
        {
            usersDataObject.SocialStatus = Convert.ToInt32(ddlSocialStatus.SelectedValue);
        }
        if (trEducationLevel.Visible)
        {
            usersDataObject.EducationLevel = Convert.ToInt32(ddlEducationLevel.SelectedValue);
        }
        if (trCountryID.Visible)
        {
            usersDataObject.CountryID = Convert.ToInt32(ddlSystemCountries.SelectedValue);
        }
        if (trCityID.Visible)
        {
            usersDataObject.CityID = Convert.ToInt32(ddlCities.SelectedValue);
        }
        //------------------------------------------------------------
        usersDataObject.UserCityName    = txtUserCityName.Text;
        usersDataObject.Tel             = txtTel.Text;
        usersDataObject.Mobile          = txtMobile.Text;
        usersDataObject.HasSmsService   = cbHasSmsService.Checked;
        usersDataObject.HasEmailService = cbHasEmailService.Checked;
        //------------------------------------------------------------
        usersDataObject.Fax     = txtFax.Text;
        usersDataObject.MailBox = txtMailBox.Text;
        usersDataObject.ZipCode = txtZipCode.Text;
        if (trJobID.Visible && !string.IsNullOrEmpty(txtJobID.Text))
        {
            usersDataObject.JobID = Convert.ToInt32(txtJobID.Text);
        }
        usersDataObject.JobText        = txtJobText.Text;
        usersDataObject.Url            = txtUrl.Text;
        usersDataObject.PhotoExtension = uploadedPhotoExtension;
        //------------------------------------------------------------
        usersDataObject.Company = txtCompany.Text;
        if (trActivitiesID.Visible)
        {
            usersDataObject.ActivitiesID = Convert.ToInt32(ddlActivitiesID.SelectedValue);
        }
        //------------------------------------------------------------
        usersDataObject.LangID = (Languages)SiteSettings.Languages_DefaultLanguageID;
        //*--------------------------------------------------------
        //ExtraData
        usersDataObject.ExtraData = txtDetails.Text;
        //*--------------------------------------------------------
        usersDataObject.ModuleTypeID = currentModule.ModuleTypeID;
        //*--------------------------------------------------------
        //usersDataObject.KeyWordsAr = txtMetaKeyWordsAr.Text;
        //usersDataObject.ShortDescriptionAr = txtShortDescriptionAr.Text;
        //*--------------------------------------------------------
        usersDataObject.OwnerID     = OwnerID;
        usersDataObject.UserType    = currentModule.UserType;
        usersDataObject.SubSiteType = currentModule.SubSiteType;
        //*--------------------------------------------------------
        //if (currentModule.HasProfilePage)
        //{
        //    SubSiteHandler.AddProfilePageDetails(usersDataObject);
        //}
        //*--------------------------------------------------------
        if (UsersDataFactory.IsSubSubSiteOwner(currentModule.UserType))
        {
            usersDataObject.OwnerName = user.UserName;
            //usersDataObject.SiteStaticPages = SubSiteHandler.GetSubSitPagesIDsString(currentModule.SubSiteType);
        }
        //*--------------------------------------------------------
        usersDataObject.UserName = user.UserName;
        //*--------------------------------------------------------
        return(UsersDataFactory.Create(user, usersDataObject));
        //*--------------------------------------------------------
    }