Exemple #1
0
        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;
            }
        }
Exemple #2
0
        /// <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 }));
        }
Exemple #3
0
        /// <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()));
        }
Exemple #4
0
 public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type)
 {
     return(Task.FromResult(new ISTrainingPartResponse <DetailInfo>(ISTrainingPartResponseCode.Ok, new DetailInfo
     {
         Phone = "88005553535",
         Address = "г.о.г. Бор",
         EMail = "*****@*****.**",
     })));
 }
Exemple #5
0
 public Task <ISTrainingPartResponse <bool> > AddOrUpdateAsync(DetailInfo detailInfo, DetailInfoType type)
 {
     return(Task.FromResult(new ISTrainingPartResponse <bool>(ISTrainingPartResponseCode.Ok, true)));
 }
Exemple #6
0
        public DetailInfoEditorViewModel(int id, DetailInfoType type, IClient client, IContainer container)
        {
            this.container = container;

            Load(client, id, type);
        }
Exemple #7
0
        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));
        }
Exemple #8
0
 public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type)
 {
     return(Task.FromResult(new ISTrainingPartResponse <DetailInfo>(ISTrainingPartResponseCode.Ok, new DetailInfo
     {
         Phone = "88005553535",
         Address = "地址",
         EMail = "*****@*****.**",
     })));
 }
Exemple #9
0
        /// <summary>
        /// Загрузка информации.
        /// </summary>
        private async void Load(IClient client, int id, DetailInfoType type)
        {
            var res = await client.DetailInfo.GetDetailInfoAsync(id, type);

            DetailInfo = res.Response;
        }
Exemple #10
0
 public Task <ISTrainingPartResponse <DetailInfo> > GetDetailInfoAsync(int id, DetailInfoType type)
 {
     return(repository.GetDetailInfoAsync(id, type));
 }
Exemple #11
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 public DetailInfoViewModel(int id, DetailInfoType type, IClient client)
 {
     Load(client, id, type);
 }
Exemple #12
0
 /// <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 }));
 }
Exemple #13
0
 /// <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 });
     }));
 }