当前位置: 首页>>代码示例>>C#>>正文


C# UserProfile类代码示例

本文整理汇总了C#中UserProfile的典型用法代码示例。如果您正苦于以下问题:C# UserProfile类的具体用法?C# UserProfile怎么用?C# UserProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserProfile类属于命名空间,在下文中一共展示了UserProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNextSentence

        public GetNextSentenceResult GetNextSentence(UserProfile profile)
        {
            // ALGO: GetNextSentence
            // PRE: Session exists
            // PRE: We are in Exercise or Review Section.
            // What we need:
            // 1. All histories
            // 2. All user current state.
            // 3. Access to sentence repository.
            // What do we do:
            // 1. Assert correct section.
            // 2. Handle Exercise section. OR
            // 3. Handle Review Section.

            var currentSection = profile.CurrentState.CourseLocationInfo.TopicLocationInfo.CurrentSection;
            if(currentSection != TopicSectionType.Review && currentSection != TopicSectionType.Exercise)
            {
                // BUG: Clean this up.
                throw new Exception("Invalid section");
            }

            GetNextSentenceResult result = null;
            if(currentSection == TopicSectionType.Exercise)
            {
                result = HandleExerciseSection(profile);
            }
            else
            {
                result = HandleReviewSection(profile);
            }

            return result;
        }
开发者ID:usmanghani,项目名称:Quantae,代码行数:33,代码来源:SentenceSelectionEngine.cs

示例2: GetAllStackEvents

        public List<ViewModels.StackEventLogViewModel> GetAllStackEvents(UserProfile user)
        {
            var StackEvents = _unitOfWork.StackEventRepository.Get();
            var events = (from c in StackEvents select new ViewModels.StackEventLogViewModel { EventDate = c.EventDate, StackEventType = c.StackEventType.Name, Description = c.Description, Recommendation = c.Recommendation, FollowUpDate = c.FollowUpDate.Value }).ToList();

            return events;
        }
开发者ID:edgecomputing,项目名称:cats-hub-module,代码行数:7,代码来源:StackEventService.cs

示例3: SetCustomProfileShouldSetEmptyProperties

    public void SetCustomProfileShouldSetEmptyProperties([CoreDb]Db db, UserProfileProvider userProfileProvider, UserProfile userProfile, IDictionary<string, string> properties, string nullKey)
    {
      properties.Add(nullKey, null);

      userProfileProvider.SetCustomProfile(userProfile, properties);
      userProfile.Received()[nullKey] = string.Empty;
    }
开发者ID:robearlam,项目名称:Habitat,代码行数:7,代码来源:UserProfileProviderTests.cs

示例4: ValueListEditAdminViewModel

 public ValueListEditAdminViewModel(StoreFront storeFront, UserProfile userProfile, ValueList valueList, string activeTab, bool isStoreAdminEdit = false, bool isReadOnly = false, bool isDeletePage = false, bool isCreatePage = false, string sortBy = "", bool? sortAscending = true)
 {
     if (storeFront == null)
     {
         throw new ArgumentNullException("storeFront");
     }
     if (userProfile == null)
     {
         throw new ArgumentNullException("userProfile");
     }
     if (valueList == null)
     {
         throw new ArgumentNullException("valueList", "valueList cannot be null");
     }
     this.IsStoreAdminEdit = isStoreAdminEdit;
     this.IsActiveDirect = valueList.IsActiveDirect();
     this.IsActiveBubble = valueList.IsActiveBubble();
     this.IsReadOnly = isReadOnly;
     this.IsDeletePage = isDeletePage;
     this.IsCreatePage = isCreatePage;
     this.ActiveTab = activeTab;
     this.SortBy = sortBy;
     this.SortAscending = sortAscending;
     LoadValues(storeFront, userProfile, valueList);
 }
开发者ID:berlstone,项目名称:GStore,代码行数:25,代码来源:ValueListEditAdminViewModel.cs

示例5: WebFormEditAdminViewModel

 public WebFormEditAdminViewModel(StoreFront storeFront, UserProfile userProfile, WebForm webForm, string activeTab, bool isStoreAdminEdit = false, bool isReadOnly = false, bool isDeletePage = false, bool isCreatePage = false, string sortBy = "", bool? sortAscending = true)
 {
     if (storeFront == null)
     {
         throw new ArgumentNullException("storeFront");
     }
     if (userProfile == null)
     {
         throw new ArgumentNullException("userProfile");
     }
     if (webForm == null)
     {
         throw new ArgumentNullException("webForm", "Web form cannot be null");
     }
     this.IsStoreAdminEdit = isStoreAdminEdit;
     this.IsActiveDirect = webForm.IsActiveDirect();
     this.IsActiveBubble = webForm.IsActiveBubble();
     this.IsReadOnly = isReadOnly;
     this.IsDeletePage = isDeletePage;
     this.IsCreatePage = isCreatePage;
     this.ActiveTab = activeTab;
     this.SortBy = sortBy;
     this.SortAscending = sortAscending;
     LoadValues(storeFront, userProfile, webForm);
 }
开发者ID:berlstone,项目名称:GStore,代码行数:25,代码来源:WebFormEditAdminViewModel.cs

示例6: PutUserProfile

        // PUT api/UserProfiles/5
        public HttpResponseMessage PutUserProfile(int id, UserProfile userprofile)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != userprofile.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(userprofile).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
开发者ID:nathanfl,项目名称:AAHIPro,代码行数:26,代码来源:UserProfilesController.cs

示例7: getYIndex

 //This functions receives two strings, the first is the job id, the second is the recruitee id.
 //then, it looks at the expressions array (all jobs ids) to find the index of the given JobID,
 //then, it looks at the users array (all users ids and self ratings) to find the index of the given recruitee id.
 //then it returns the value of the rating for that job and recruitee on the Y matrix.
 public int[,] getYIndex(String jobID, String recruiteeID, String[] expressions, UserProfile[] users)
 {
     try
     {
         int column = 0, row = 0;
         for (int i = 0; i < expressions.Length; i++)
         {
             if ((expressions[i].ToUpper()).Equals(jobID.ToUpper()))
             {
                 row = i;
                 break;
             }
         }
         for (int i = 0; i < users.Length; i++)
         {
             if ((users[i].UserID.ToUpper()).Equals(recruiteeID.ToUpper()))
             {
                 column = i;
                 break;
             }
         }
         int[,] result = new int[1, 2];
         result[0, 0] = row;
         result[0, 1] = column;
         return result;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
开发者ID:laerteneto,项目名称:UmRecommendedJobSystem,代码行数:35,代码来源:ElasticSvcImpl.cs

示例8: btnSave_Click

        protected void btnSave_Click(object sender, EventArgs e)
        {
            // Use EF to connect to SQL Server
            using (fit_trackEntities db = new fit_trackEntities())
            {
                // Use the UserProfile Model to save the new record
                UserProfile up = new UserProfile();
                String UserID = Convert.ToString(User.Identity.GetUserId());

                // Get the current UserProfile from the Enity Framework
                up = (from objS in db.UserProfiles
                      where objS.UserID == UserID
                      select objS).FirstOrDefault();

                up.FirstName = txtFirstName.Text;
                up.LastName = txtLastName.Text;
                up.Email = txtEmail.Text;
                up.UserHeight = Convert.ToDecimal(txtHeight.Text);
                up.UserWeight = Convert.ToDecimal(txtWeight.Text);
                up.Age = Convert.ToInt32(txtAge.Text);

                db.SaveChanges();

                // Redirect to the updated Profile page
                Response.Redirect("profile.aspx");
            }
        }
开发者ID:Itniraan,项目名称:fitness_weight_tracker,代码行数:27,代码来源:editProfile.aspx.cs

示例9: Execute

        public override void Execute()
        {
            //Start loading => write to synch db? => profile + basedata always loaded synchroneously

            _userProfile = new UserProfile();
            //end loading => save to DB
        }
开发者ID:Detroier,项目名称:playground,代码行数:7,代码来源:LoadUserProfileCommand.cs

示例10: DoProcessRequest

        public override void DoProcessRequest(IExecutionContext context)
        {
            if (!Validate())
                return;

            UserProfile user = new UserProfile();

            user.UserName = username;
            user.Password = password;
            user.Email = email;
            user.FirstName = firstName;
            user.LastName = lastName;

            user.UserType = 
                ContentTypeUtility.AsUserType(
                    ContentTypeUtility.FromString(defaultContentType));

            if (user.UserType == UserType.Company) {
                user.roles = new List<UserProfile.role>();
                var role = new UserProfile.role();
                role.Name = "company";
                user.roles.Add(role);
            }

            UserDataAccess.Instance.SaveUser(user);
            context.Response.RenderWith(@"Templates\Profile\registered.django");
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:27,代码来源:Profile.cs

示例11: Index

        public ActionResult Index()
        {
            var profile = Context.Database.UserProfiles.SingleOrDefault(x => x.UserId == WebSecurity.CurrentUserId);

            if (profile == null)
            {
                //TODO: use the existing language set on UI to create the default profile.
                var language = Context.Database.Languages.GetByName("English");
                profile = new UserProfile(WebSecurity.CurrentUserId, language.Id);
                Context.Database.UserProfiles.Add(profile);
                Context.SaveChanges();
            }

            var model = new UserProfileModel
            {
                Bio = profile.Bio,
                BirthDay = profile.BirthDay.HasValue ? profile.BirthDay : new DateTime?(),
                Department = profile.Department,
                Expertise = profile.Expertise,
                FacebookProfile = profile.FacebookProfile,
                SkypeName = profile.SkypeName,
                Interests = profile.Interests,
                JobTitle = profile.JobTitle,
                Languages = new SelectList(Context.Database.Languages.ToList(), "Id", "Name"),
                LanguageId = profile.LanguageId,
                LinkedinProfile = profile.LinkedinProfile,
                Location = profile.Location,
                MobilePhone = profile.MobilePhone,
                TwitterUserName = profile.TwitterUserName,
                WorkPhone = profile.WorkPhone,
                WorkPhoneExtension = profile.WorkPhoneExtension
            };

            return View("Account", model);
        }
开发者ID:hveiras,项目名称:TeamMashup,代码行数:35,代码来源:AccountController.cs

示例12: GetUserProfile

	public static UserProfile GetUserProfile(HttpContext context)
	{
        var profile = context.Items["Profile"] as UserProfile;
        if (profile == null)
        {
            var authCookie = context.Request.Cookies["u"];
            if (authCookie == null)
            {
                profile = new UserProfile
                {
                    Username = Guid.NewGuid().ToString()                   
                };
                context.Items["Profile"] = profile;
                return profile;
            }
            else
            {
                var userName = FormsAuthentication.Decrypt(authCookie.Value).Name;
                var userProfile = LoginProvider.GetUserProfile(context.Server.MapPath("~/App_Data"), userName);
                context.Items["Profile"] = userProfile;
                return userProfile;
            }
        }
        else
        {
            return context.Items["Profile"] as UserProfile;
        }
	}
开发者ID:Happy-Ferret,项目名称:Droptiles,代码行数:28,代码来源:SecurityContextManager.cs

示例13: AddUser

        public void AddUser()
        {
            using (var db = new StationCADDb())
            {
                var usr = new UserProfile();
                usr.FirstName = string.Format("FirstName_{0}", DateTime.Now.Ticks);
                usr.LastName = string.Format("LastName_{0}", DateTime.Now.Ticks);
                usr.IdentificationNumber = DateTime.Now.Ticks.ToString();
                //usr.UserName = string.Format("{0}.{1}", usr.FirstName, usr.LastName);
                usr.OrganizationAffiliations = new List<OrganizationUserAffiliation>();
                usr.OrganizationAffiliations.Add(new OrganizationUserAffiliation { Status = OrganizationUserStatus.Active, Role = OrganizationUserRole.User });
                usr.NotificationEmail = "[email protected]";
                usr.MobileDevices = new List<UserMobileDevice>();
                usr.MobileDevices.Add(new UserMobileDevice { Carrier = MobileCarrier.ATT, EnableSMS = true, MobileNumber = "6108833253" });

                db.UserProfiles.Add(usr);
                db.SaveChanges();

                Assert.IsTrue(usr.Id > 0);

                List<UserProfile> users = db.UserProfiles
                    .Include("MobileDevices")
                    .Include("OrganizationAffiliations")
                    .Where(w => w.OrganizationAffiliations.Where(x => x.CurrentOrganization.Id == 1).Count() > 0)
                    .ToList<UserProfile>();

                var afterUser = db.UserProfiles
                    .Include("OrganizationAffiliations")
                    .Include("MobileDevices")
                    .Where(x => x.IdentificationNumber == usr.IdentificationNumber)
                    .FirstOrDefault();
                db.UserProfiles.Remove(afterUser);
                db.SaveChanges();
            }
        }
开发者ID:sergioora,项目名称:StationCAD,代码行数:35,代码来源:UserTests.cs

示例14: HandleExerciseSection

        private GetNextSentenceResult HandleExerciseSection(UserProfile profile)
        {
            // PRE: By the time we come here. we have already been moved to either
            // starting next pack or being in a valid question dimension by the state evaluator
            // if starting exercise pack
            //       select sample sentence.
            //       return it.
            // else
            //       select sentence for this question dimension.
            //       return it.

            Sentence sentence = null;
            bool isQuestion = false;
            QuestionDimension dimension = QuestionDimension.Unknown;
            bool found = false;

            sentence = SentenceOperations.FindSentence(profile);

            if(sentence != null)
            {
                found = true;
            }

            if (!SectionUtilities.StartingExercisePack(profile))
            {
                isQuestion = true;
                dimension = profile.CurrentState.CourseLocationInfo.TopicLocationInfo.ExerciseSectionState.CurrentQuestionDimension;
            }

            GetNextSentenceResult result = new GetNextSentenceResult(sentence: sentence, success: found, isQuestion: isQuestion, dimension: dimension, isReview: false);

            return result;
        }
开发者ID:usmanghani,项目名称:Quantae,代码行数:33,代码来源:SentenceSelectionEngine.cs

示例15: GetSingleValuedProperty

        private static string GetSingleValuedProperty(UserProfile spUser,string userProperty)
        {
            string returnString = string.Empty;
            try
            {
                UserProfileValueCollection propCollection = spUser[userProperty];

                if (propCollection[0] != null)
                {
                    returnString = propCollection[0].ToString();
                }
                else
                {
                    LogMessage(string.Format("User '{0}' does not have a value in property '{1}'", spUser.DisplayName, userProperty), LogLevel.Warning);                       
                }
            }
            catch 
            {
                LogMessage(string.Format("User '{0}' does not have a value in property '{1}'", spUser.DisplayName, userProperty), LogLevel.Warning);                       
            }


            return returnString;
            
        }
开发者ID:NicolajLarsen,项目名称:PnP,代码行数:25,代码来源:Program.cs


注:本文中的UserProfile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。