private async void Load(IClient client, int id, DetailInfoType type) { var res = await client.DetailInfo.GetDetailInfoAsync(id, type); var item = res.Response; if (item == null) { item = new DetailInfo(); } Editor = new BaseEditModeViewModel <DetailInfo>(item, true, container); switch (type) { case DetailInfoType.Staff: Editor.EditableObject.Staff = id; break; case DetailInfoType.Student: Editor.EditableObject.Student = id; break; } }
/// <summary> /// Добавить или сохранить детальную информацию. /// </summary> /// <param name="detailInfo">Детальная информация.</param> /// <returns></returns> public Task <ISTrainingPartResponse <bool> > AddOrUpdateAsync(Core.Models.DetailInfo detailInfo, DetailInfoType type) { Logger.Log.Info($"Сохранение детальной информации: {{id: {detailInfo.Id}, {detailInfo}, type: {type}}}"); return(TryInvokeAsync <bool>(args: new object[] { detailInfo, type })); }
/// <summary> /// Получить детальную информацию. /// </summary> /// <param name="id">ИД человека.</param> /// <param name="type">Тип человека.</param> /// <returns></returns> public Task <ISTrainingPartResponse <Core.Models.DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type) { Logger.Log.Info($"Получение детальной информации: {{people id: {id}, type: {type}}}"); return(TryInvokeAsync(args: new object[] { id, type }, defaultValue: new Core.Models.DetailInfo())); }
public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type) { return(Task.FromResult(new ISTrainingPartResponse <DetailInfo>(ISTrainingPartResponseCode.Ok, new DetailInfo { Phone = "88005553535", Address = "г.о.г. Бор", EMail = "*****@*****.**", }))); }
public Task <ISTrainingPartResponse <bool> > AddOrUpdateAsync(DetailInfo detailInfo, DetailInfoType type) { return(Task.FromResult(new ISTrainingPartResponse <bool>(ISTrainingPartResponseCode.Ok, true))); }
public DetailInfoEditorViewModel(int id, DetailInfoType type, IClient client, IContainer container) { this.container = container; Load(client, id, type); }
public Task <ISTrainingPartResponse <bool> > AddOrUpdateAsync(DetailInfo detailInfo, DetailInfoType type) { Logger.Log.Info($"Save detail info: {{student: {detailInfo.Student}, staff: {detailInfo.Staff}}}"); return(repository.AddOrUpdateAsync(detailInfo, type)); }
public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type) { return(Task.FromResult(new ISTrainingPartResponse <DetailInfo>(ISTrainingPartResponseCode.Ok, new DetailInfo { Phone = "88005553535", Address = "地址", EMail = "*****@*****.**", }))); }
/// <summary> /// Загрузка информации. /// </summary> private async void Load(IClient client, int id, DetailInfoType type) { var res = await client.DetailInfo.GetDetailInfoAsync(id, type); DetailInfo = res.Response; }
public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type) { return(repository.GetDetailInfoAsync(id, type)); }
/// <summary> /// Конструктор. /// </summary> public DetailInfoViewModel(int id, DetailInfoType type, IClient client) { Load(client, id, type); }
/// <summary> /// Окно детальной информации. /// </summary> /// <param name="id">ИД человека.</param> /// <param name="type">Тип человека.</param> /// <returns></returns> public Task ShowDetailInfo(int id, DetailInfoType type) { return(show <DetailInfo, DetailInfoViewModel>(new object[] { id, type })); }
/// <summary> /// Окно редактирования детальной информации. /// </summary> /// <param name="id">ИД человека.</param> /// <param name="type">Тип человека.</param> /// <returns></returns> public Task <DetailInfo> ShowDetailInfoEditor(int id, DetailInfoType type) { return(show <DetailInfo, DetailInfoEditorViewModel>(new object[] { id, type })); }
public Task <ISTrainingPartResponse <bool> > AddOrUpdateAsync(DetailInfo detailInfo, DetailInfoType type) { return(repository.QueryAsync(async con => { if (detailInfo.Id > 0) { return await con.UpdateAsync(detailInfo); } else { return await con.InsertAsync(detailInfo) > 0; } })); }
public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type) { return(repository.QueryAsync(con => { return con.QueryFirstOrDefaultAsync <DetailInfo>($"SELECT * FROM detailInfo WHERE {type} = @peopleId", new { peopleId = id }); })); }