本文整理汇总了C#中UserService.GetByID方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.GetByID方法的具体用法?C# UserService.GetByID怎么用?C# UserService.GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService.GetByID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
UserService service = new UserService();
ProfileControl1.AdminView = true;
ProfileControl1.FillForm(service.GetByID(UserID));
}
}
示例2: Submit_Click
/// <summary>
/// Handles the Click event of the Submit control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Submit_Click(object sender, EventArgs e)
{
if (!IsValid)
{
return;
}
//store new user information to database
UserService service = new UserService();
User user = service.GetByID(UserID);
ProfileControl1.FillUser(user);
service.Update(user);
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ProfileControl1.Editable = false;
// get the developer
UserService service = new UserService();
User dev = service.GetByID(DevID);
// fill the form
ProfileControl1.FillForm(dev);
// bind complevels
ddlComp.DataSource = Enum.GetNames(typeof (CompLevel));
ddlComp.DataBind();
ddlComp.Items.Insert(0, String.Empty);
// select dev's comp level
//ListItem item = ddlComp.Items.FindByValue(dev.Competency.ToString());
//if (item != null)
// item.Selected = true;
}
}
示例4: UpdateEnabled
public void UpdateEnabled()
{
UserService target = new UserService();
User user = (User) CreateRecord();
Insert(user);
user.Enabled = !user.Enabled;
target.Enable(user.ID, user.Enabled);
User updated = target.GetByID(user.ID);
Assert.AreEqual(user.Enabled, updated.Enabled);
}
示例5: Update
public override void Update()
{
UserService target = new UserService();
User user = (User) CreateRecord();
Insert(user);
user.LastName = "updated last name";
target.Update(user);
User updated = target.GetByID(user.ID);
Assert.AreEqual(user.LastName, updated.LastName);
}
示例6: Insert
public override void Insert()
{
UserService target = new UserService();
User user = (User) CreateRecord();
Insert(user);
Assert.IsNotNull(target.GetByID(user.ID));
Assert.IsTrue(target.Exists(user.ID));
}
示例7: GetByUsername
public void GetByUsername()
{
UserService target = new UserService();
User user = (User) CreateRecord();
Insert(user);
User user2 = target.GetByID(user.Username);
Assert.IsNotNull(user2);
Assert.AreEqual(user.Username, user2.Username);
}