本文整理汇总了C#中Person.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Person.Load方法的具体用法?C# Person.Load怎么用?C# Person.Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadAvatar
void DownloadAvatar()
{
var avatar = new Person(TestPersonId);
var loadRoutine = avatar.Load(error =>
{
Debug.LogError("Failed to Load person details during Avatar test");
}, success =>
{
var downloadRoutine = avatar.Avatar.Download(textureSuccess =>
{
var testObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
testObject.GetComponent<Renderer>().material.mainTexture = avatar.Avatar.Texture;
if (avatar.Avatar.Texture.width > 0)
{
Debug.Log("Avatar download Passed");
}
else
{
Debug.LogError("Avatar download got an empty texture");
}
});
StartCoroutine(downloadRoutine);
});
StartCoroutine(loadRoutine);
}
示例2: SaveUserChanges
/// <summary>
/// Saves information about user and returns modified user.
/// </summary>
/// <returns>Object of modified user.</returns>
public virtual Person SaveUserChanges()
{
Person user = new Person();
if (UserID != null)
user.Load(UserID.Value);
user.FirstName = tbFirstName.MultilingualText;
user.MiddleName = tbMiddleName.MultilingualText;
user.LastName = tbLastName.MultilingualText;
user.Sex = (Person.UserSex) ddlSex.SelectedIndex;
user.Birthday = string.IsNullOrEmpty(tbBirthday.Text)
? (DateTime?) null
: DateTime.Parse(tbBirthday.Text);
user.PrimaryEMail = tbPrimaryEMail.Text;
user.Project = tbProject.Text;
user.Room = tbRoom.Text;
user.PrimaryIP = tbPrimaryIP.Text;
user.Save();
dnEditor.GenerateDomainNames(user.ID.Value);
gmEditor.GenerateMembership(user.ID.Value);
return user;
}
示例3: GetLinkedDataPredicates
public string[] GetLinkedDataPredicates(string subjectId)
{
Person pers = new Person(subjectId, Person.PersonDataSystems.gnd);
//PersonDataClient persDC = pers.PersonDataClient;
//RQPersonGraph persGraph = (RQPersonGraph)(((LDPersonDataClient)persDC).LDGraph);
RQPersonGraph persGraph = (RQPersonGraph)(((LDPersonDataClient)pers.PersonDataClient).LDGraph);
pers.EnableLinkedData();
pers.Load();
pers.DisableLinkedData();
return persGraph.GetPredicates(pers.PersonID);
}
示例4: GetNewsAuthorMail
/// <summary>
/// Get the author E-Mail of news.
/// </summary>
/// <param name="objContainer">data container.</param>
/// <returns></returns>
protected String GetNewsAuthorMail(Object objContainer)
{
GridViewRow row = objContainer as GridViewRow;
if (row == null)
return String.Empty;
Person author = new Person();
author.Load(((News)row.DataItem).AuthorID);
if (String.IsNullOrEmpty(author.PrimaryEMail))
return String.Empty;
return String.Format("mailto:{0}", author.PrimaryEMail);
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Получить текущего пользователя.
Person curUser = new Person();
if (Session["UserID"] != null)
{
curUser.Load((int)Session["UserID"]);
//FIXME: very interessant part of code
if (((string)GetLocalResourceObject("Greetings.Text")).Contains("{0}"))
locGreetings.Text = String.Format((string)GetLocalResourceObject("Greetings.Text"),
curUser.FullName);
else
locGreetings.Text = String.Format((string)GetLocalResourceObject("Greetings.Text")
+ " {0}", curUser.FullName);
}
else
Visible = false;
}
示例6: OnLoad
/// <summary>
/// Обработчик события загрузки страницы.
/// </summary>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Получить пользователя, который запрашивает страницу.
if (string.IsNullOrEmpty(Request.QueryString["UserID"]))
Response.Redirect(hlMain.NavigateUrl);
int userID;
if (!Int32.TryParse(Request.QueryString["UserID"], out userID))
Response.Redirect(hlMain.NavigateUrl);
Person user = new Person();
if (!user.Load(userID))
Response.Redirect(hlMain.NavigateUrl);
DateTime begin;
DateTime end;
if (!DateClass.TryParseRequestQueryDates(Request, out begin, out end))
Response.Redirect(hlMain.NavigateUrl);
userStat.ShowStatistics(user, begin, end);
}
示例7: GetPersonByID
/// <summary>
/// Returns person with given ID.
/// </summary>
/// <param name="personID">ID of person.</param>
/// <returns>Person with given ID.</returns>
public static Person GetPersonByID(int personID)
{
try
{
string cacheKey = String.Format("Person with ID '{0}'", personID);
if (Cache.Contains(cacheKey))
{
DateTime now = DateTime.Now;
DateTime insertDate = Cache.InsertDate(cacheKey).Value;
if (insertDate < (now - Settings.Default.PersonExpireTime))
Cache.Remove(cacheKey);
else
return (Person) Cache.GetObject(cacheKey);
}
Person p = new Person();
if (p.Load(personID))
{
Cache.Add(cacheKey, p);
return p;
}
return null;
}
catch (Exception ex)
{
Logger.Log.Error(ex.Message, ex);
return null;
}
}
示例8: Page_Load
protected void Page_Load( object sender, EventArgs e )
{
// Получить ID пользователя, информация которого отображается.
string userIDStr = Request.QueryString["UserID"];
if (string.IsNullOrEmpty(userIDStr))
Response.Redirect(hlMain.NavigateUrl);
int userID;
if(!Int32.TryParse(userIDStr, out userID))
Response.Redirect( hlMain.NavigateUrl );
// Получить пользователя, информация которого отображается.
m_InfoUser = new Person();
m_InfoUser.Load(userID);
// Показать имя пользователя.
lblUserName.Text = m_InfoUser.FullName;
if(!IsPostBack)
{
Calendar.SelectedDate = DateTime.Today;
Calendar_SelectionChanged( Calendar, new EventArgs() );
}
}
示例9: fillUserInfo
/// <summary>
/// Заполняет элементы управления информацией о пользователe.
/// </summary>
private void fillUserInfo()
{
if (UserID == null)
return;
Person user = new Person();
if (!user.Load(UserID.Value))
{
lblFirstName.Text = lblMiddleName.Text
= lblLastName.Text = lblSex.Text
= lblBirthday.Text = "Error while loading person information.";
return;
}
lblFirstName.Text = user.FirstName.ToString();
lblMiddleName.Text = user.MiddleName.ToString();
lblLastName.Text = user.LastName.ToString();
lblSex.Text = user.Sex.ToString();
lblBirthday.Text = user.Birthday != null
? user.Birthday.Value.ToShortDateString()
: string.Empty;
}
示例10: GetPersonDetails
void GetPersonDetails()
{
var newPerson = new Person(TestPersonId);
var getPersonDetails = newPerson.Load(error =>
{
Debug.LogError(error.Message);
}, success =>
{
if (newPerson.DisplayName != null)
{
Debug.Log("Get Person Details Passed!");
UpdatePerson();
}
});
StartCoroutine(getPersonDetails);
}
示例11: fillUserInfo
/// <summary>
/// Заполняет элементы управления информацией о пользователях.
/// </summary>
private void fillUserInfo()
{
Person user = new Person();
if (UserID != null)
user.Load(UserID.Value);
tbFirstName.MultilingualText = user.FirstName;
tbMiddleName.MultilingualText = user.MiddleName;
tbLastName.MultilingualText = user.LastName;
if (ddlSex.Items.Count == 0)
FillSexList();
ddlSex.SelectedIndex = (int)user.Sex;
tbBirthday.Text = user.Birthday != null
? user.Birthday.Value.ToShortDateString()
: string.Empty;
dnEditor.UserID = user.ID;
tbPrimaryEMail.Text = user.PrimaryEMail;
tbProject.Text = user.Project;
tbRoom.Text = user.Room;
tbPrimaryIP.Text = user.PrimaryIP;
gmEditor.UserID = user.ID;
}
示例12: GetUserListWithOpenWorkPeriod
/// <summary>
/// Возвращает список пользователей с открытыми рабочими событиями.
/// </summary>
/// <returns>Список пользователей с открытыми рабочими событиями.</returns>
public static Person[] GetUserListWithOpenWorkPeriod()
{
DataTable dt = DBManager.GetUserListWithOpenWorkPeriod();
if( dt == null )
return null;
List<Person> usersList = new List<Person>();
foreach( DataRow row in dt.Rows )
{
int id = (int) row[ "ID" ];
Person user = new Person();
if( user.Load( id ) )
usersList.Add( user );
}
if( usersList.Count > 0 )
return usersList.ToArray();
else
return null;
}
示例13: DataBind
/// <summary>
/// DataBindig row.
/// </summary>
public override void DataBind()
{
hlCaption.Text = CurrentNews.Caption;
if (!IsInPreviewMode)
hlCaption.NavigateUrl = hlCaption.NavigateUrl + NewsID;
Person author = new Person();
author.Load(CurrentNews.AuthorID);
if (!String.IsNullOrEmpty(author.PrimaryEMail))
hlAuthorName.NavigateUrl = String.Format("mailto:{0}", author.PrimaryEMail);
lblDateTime.Text = (CurrentNews.CreateTime.Date == DateTime.Now.Date)
? GetGlobalResourceObject("NewsTape", "Today")
+ " " + CurrentNews.CreateTime.ToShortTimeString()
: CurrentNews.CreateTime.ToShortDateString()
+ " " + CurrentNews.CreateTime.ToShortTimeString();
newsText.InnerHtml = CurrentNews.Text;
hlDeleteNews.CommandArgument = NewsID.ToString();
String strOffice = (CurrentNews.OfficeID == 0) // общие новости.
? GetGlobalResourceObject("NewsTape", "generalNews").ToString()
: CurrentNews.OfficeName;
imgNewsType.ImageUrl = "~/Images/generalNewsImage.gif";
imgNewsType.ToolTip = strOffice;
imgNewsType.AlternateText = strOffice;
if (IsInFullHeightMode) //режим полного отображения новости
{
string[] stringSeparators = new string[] {"<LI>", "<BR>", "<li>", "<br>"};
string[] rows = newsText.InnerHtml.Split(stringSeparators, StringSplitOptions.None);
if (!(rows.Length > 6 || newsText.InnerHtml.Length > 3000))
newsText.Style.Add("height", "130px");
}
else
newsText.Style.Add("height", "130px");
setLinksVisibility();
setFilesAttachments();
setText();
}
示例14: SetUp
public void SetUp()
{
person = new Person();
person.Birthday = DateTime.Now;
person.EmployeesUlterSYSMoscow = true;
person.FirstName = new MLText( "en", "Tester", "ru", "Тест" );
person.LastName = new MLText( "en", "Tester", "ru", "Тестов" );
person.LongServiceEmployees = true;
person.MiddleName = new MLText( "en", "T.", "ru", "Тестович" );
person.PersonnelReserve = true;
person.PrimaryEMail = "[email protected]";
person.PrimaryIP = "127.0.0.1";
person.Project = "Project";
person.Room = "Room";
person.Sex = Person.UserSex.Female;
person.Save();
domainNameAttr = new PersonAttribute();
domainNameAttr.StringField = domainName;
domainNameAttr.ValueType = typeof( string ).AssemblyQualifiedName;
domainNameAttr.PersonID = person.ID.Value;
domainNameAttr.Save();
loaded = new Person();
loaded.Load( person.ID.Value );
/*group = new Group();
group.GroupType = Group.GroupsEnum.Employee;
group.Name = new MLText( "en", "Employees" );
group.Description = new MLText( "en", "Employees" );
group.Save();*/
}
示例15: fillStatistics
/// <summary>
/// Заполняет элементы управления информацией о статистике.
/// </summary>
private void fillStatistics()
{
Visible = false;
if (UserID == null
|| BeginDate == DateTime.MinValue
|| EndDate == DateTime.MinValue)
return;
// Создать пользователя.
Person user = new Person();
if (!user.Load(UserID.Value))
return;
// Получить статистику за данный период.
PeriodUserStatistics stat = PeriodUserStatistics.GetUserStatistics(user,
BeginDate,
EndDate);
if (stat == null)
return;
// Связать данные с таблицей.
grdDaysStats.DataSource = stat.DaysStatistics;
grdDaysStats.DataBind();
// Показать общее время и рабочее время.
lblTotalTime.Text = " " + DateTimePresenter.GetTime(stat.TotalTime);
lblWorkTime.Text = " " + DateTimePresenter.GetTime(stat.WorkTime);
lblTimeRate.Text = " " + DateTimePresenter.GetTime(stat.TimeRate);
lblRestTime.Text = " " + DateTimePresenter.GetTime(stat.RestTime);
Visible = true;
}