本文整理汇总了C#中UserProfile类的典型用法代码示例。如果您正苦于以下问题:C# UserProfile类的具体用法?C# UserProfile怎么用?C# UserProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserProfile类属于命名空间,在下文中一共展示了UserProfile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UserProfileEditModel
public UserProfileEditModel(UserProfile userProfile, User user)
{
if (userProfile != null)
{
Birthday = userProfile.Birthday;
BirthdayType = userProfile.BirthdayType;
Email = !string.IsNullOrEmpty(userProfile.Email) ? userProfile.Email : user.AccountEmail;
Gender = userProfile.Gender;
HomeAreaCode = userProfile.HomeAreaCode;
Introduction = userProfile.Introduction;
Mobile = userProfile.Mobile;
Msn = userProfile.Msn;
NowAreaCode = userProfile.NowAreaCode;
QQ = userProfile.QQ;
UserId = userProfile.UserId;
}
if (user != null)
{
TrueName = user.TrueName;
NickName = user.NickName;
AccountEmail = user.AccountEmail;
UserName = user.UserName;
IsEmailVerified = user.IsEmailVerified;
}
}
开发者ID:hbulzy,项目名称:SYS,代码行数:25,代码来源:UserProfileEditModel.cs
示例17: GetMultiValuedProperty
private static string GetMultiValuedProperty(UserProfile spUser, string userProperty)
{
StringBuilder sb = new StringBuilder("");
string seperator = ConfigurationManager.AppSettings["PROPERTYSEPERATOR"];
string returnString = string.Empty;
try
{
UserProfileValueCollection propCollection = spUser[userProperty];
if (propCollection.Count > 1)
{
for (int i = 0; i < propCollection.Count; i++)
{
if (i == propCollection.Count - 1) { seperator = ""; }
sb.AppendFormat("{0}{1}", propCollection[i], seperator);
}
}
else if (propCollection.Count == 1)
{
sb.AppendFormat("{0}", propCollection[0]);
}
}
catch
{
LogMessage(string.Format("User '{0}' does not have a value in property '{1}'", spUser.DisplayName, userProperty), LogLevel.Warning);
}
return sb.ToString();
}
开发者ID:NicolajLarsen,项目名称:PnP,代码行数:33,代码来源:Program.cs
示例18: Update
public UserProfile Update(UserProfile user)
{
try
{
if (ApiUrl == string.Empty)
{
throw new Exception(Errors.ERR_PROFILEM_MISSING_APIURL);
}
var uriBuilder = new UriBuilder(ApiUrl + "/users/id/" + user.id);
if (DevKey != string.Empty)
{
uriBuilder.Query = "subscription-key=" + DevKey;
}
var strModel = ModelManager.ModelToJson(user);
var json = Rest.Put(uriBuilder.Uri, strModel);
user = ModelManager.JsonToModel<UserProfile>(json);
}
catch (Exception err)
{
var errString = string.Format(Errors.ERR_PROFILEM_PROFILE_NOT_CREATED, user.firstname + " " + user.lastname) + ", " + err.Message;
if (err.InnerException != null)
errString += ", " + err.InnerException.Message;
throw new Exception(errString);
}
return user;
}
开发者ID:MSFTImagine,项目名称:microservices-iot-azure,代码行数:32,代码来源:ProfileSDK.cs
示例19: GetUnderstandingScore
public static double GetUnderstandingScore(UserProfile profile)
{
int successCount = profile.CurrentState.CourseLocationInfo.CurrentTopic.AnswerDimensionSuccessCount[AnswerDimension.Understanding];
int failureCount = profile.CurrentState.CourseLocationInfo.CurrentTopic.AnswerDimensionFailureCount[AnswerDimension.Understanding];
return (double)successCount / (successCount + failureCount);
}
开发者ID:usmanghani,项目名称:Quantae,代码行数:7,代码来源:TopicPolicies.cs
示例20: UserProfile_WhenDeleted_IsNotRemovedFromTheDatabase
public void UserProfile_WhenDeleted_IsNotRemovedFromTheDatabase()
{
StoreExpectedProfile();
db.DeleteUser(expectedProfile.UserId);
actualProfile = (from p in db.UserProfiles where p.UserId == expectedProfile.UserId select p).First();
Assert.AreEqual(false, actualProfile.Status);
}
开发者ID:pragmaticpat,项目名称:EdwardsFoundation,代码行数:7,代码来源:UserProfileTests.cs
注:本文中的UserProfile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论