private async Task Edit(InspectionEntity entity) { selected = entity; var parameters = new NavigationParameters() .SetValue(EditParameter.Value, entity.Qty) .SetValue(EditParameter.ResetValue, entity.Qty); await navigator.PushModelAsync("/Edit/QtyEditPage", parameters); }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, InspectionEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public void OnNavigatingTo(NavigationContext context) { if (context.IsPopBack) { var value = context.Parameters.GetValueOrDefault <long?>(EditParameter.Value); if (value.HasValue) { selected.Qty = value.Value; updated = true; UpdateSummary(); selected = null; } } }
public async Task <AddResult> AddRecord(string number, int startYear, int expireYear, bool isPassed, int transportId) { InspectionEntity inspectionEntity = new InspectionEntity { Number = number, StartYear = startYear, ExpireYear = expireYear, IsPassed = isPassed, TransportId = transportId }; await dbContext.Inspections.AddAsync(inspectionEntity); await dbContext.SaveChangesAsync(); if (await dbContext.Inspections.AnyAsync(i => i.Id == inspectionEntity.Id)) { return(AddResult.Success); } return(AddResult.Failed); }
public async Task <StatusEntityPair <InspectionStatusEntity, InspectionEntity> > QueryInspectionAsync(int storageNo) { var path = Path.Combine(Definition.InspectionDirectory, Definition.InspectionFileFormatter(storageNo)); if (!fileService.IsFileExists(path)) { return(new StatusEntityPair <InspectionStatusEntity, InspectionEntity>( new InspectionStatusEntity { StorageNo = storageNo }, Enumerable.Empty <InspectionEntity>())); } using (var stream = await fileService.OpenReadAsync(path).ConfigureAwait(false)) { // Status var buffer = new byte[InspectionStatusEntity.Size]; stream.Read(buffer, 0, buffer.Length); var status = new InspectionStatusEntity(); status.FromBytes(buffer); // Entity var count = (int)((stream.Length - InspectionEntity.Size) / InspectionEntity.Size); var list = new List <InspectionEntity>(count); buffer = new byte[InspectionEntity.Size]; for (var i = 0; i < count; i++) { stream.Position = (InspectionEntity.Size * i) + InspectionStatusEntity.Size; stream.Read(buffer, 0, buffer.Length); var entity = new InspectionEntity { DetailNo = i + 1 }; entity.FromBytes(buffer); list.Add(entity); } return(new StatusEntityPair <InspectionStatusEntity, InspectionEntity>(status, list)); } }
public async Task <DeleteResult> DeleteRecord(int recordId) { InspectionEntity inspectionEntity = await dbContext.Inspections.FirstOrDefaultAsync(a => a.Id == recordId); if (inspectionEntity == null) { return(DeleteResult.RecordNotFound); } dbContext.Inspections.Remove(inspectionEntity); await dbContext.SaveChangesAsync(); if (!await dbContext.Inspections.AnyAsync(a => a.Id == inspectionEntity.Id)) { return(DeleteResult.Success); } return(DeleteResult.Failed); }
public ActionResult SaveForm(string keyValue, InspectionEntity entity) { inspectionbll.SaveForm(keyValue, entity); return(Success("操作成功。")); }