public void Send(string username, string password, int deviceType) { user = new FlowUser(username, password); client = new FlowClient(deviceType); CommandProcessor.sendCommand(this); }
public async Task <VerifyRecordResult> DeleteAsync(int id) { try { CleanTrackingHelper.Clean <FlowUser>(context); FlowUser item = await context.FlowUser .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == id); if (item == null) { return(VerifyRecordResultFactory.Build(false, ErrorMessageEnum.無法刪除紀錄)); } else { CleanTrackingHelper.Clean <FlowUser>(context); context.Entry(item).State = EntityState.Deleted; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <FlowUser>(context); return(VerifyRecordResultFactory.Build(true)); } } catch (Exception ex) { Logger.LogError(ex, "刪除記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "刪除記錄發生例外異常", ex)); } }
public void Send() { user = new FlowUser(Config.userId); client = new FlowClient(Config.deviceId); CommandProcessor.sendCommand(this); }
public async Task <VerifyRecordResult> UpdateAsync(FlowUserAdapterModel paraObject) { try { FlowUser itemData = Mapper.Map <FlowUser>(paraObject); CleanTrackingHelper.Clean <FlowUser>(context); FlowUser item = await context.FlowUser .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == paraObject.Id); if (item == null) { return(VerifyRecordResultFactory.Build(false, ErrorMessageEnum.無法修改紀錄)); } else { CleanTrackingHelper.Clean <FlowUser>(context); context.Entry(itemData).State = EntityState.Modified; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <FlowUser>(context); return(VerifyRecordResultFactory.Build(true)); } } catch (Exception ex) { Logger.LogError(ex, "修改記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "修改記錄發生例外異常", ex)); } }
public void Send(int deviceType) { client = new FlowClient(deviceType); user = new FlowUser(Config.userId); CommandProcessor.sendCommand(this); }
public void Send(string projectName) { project = new FlowProject(); project.projectName = projectName; user = new FlowUser(Config.userId); client = new FlowClient(Config.deviceId); CommandProcessor.sendCommand(this); }
public void send(string username) { user = new FlowUser(); user.username = username; project = new FlowProject(Config.projectId); CommandProcessor.sendCommand(this); }
public async Task <FlowUserAdapterModel> GetAsync(int id) { FlowUser item = await context.FlowUser .AsNoTracking() .Include(x => x.MyUser) .FirstOrDefaultAsync(x => x.Id == id); FlowUserAdapterModel result = Mapper.Map <FlowUserAdapterModel>(item); await OhterDependencyData(result); return(result); }
public async Task <VerifyRecordResult> AddAsync(FlowUserAdapterModel paraObject) { try { FlowUser itemParameter = Mapper.Map <FlowUser>(paraObject); CleanTrackingHelper.Clean <FlowUser>(context); await context.FlowUser .AddAsync(itemParameter); await context.SaveChangesAsync(); CleanTrackingHelper.Clean <FlowUser>(context); return(VerifyRecordResultFactory.Build(true)); } catch (Exception ex) { Logger.LogError(ex, "新增記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "新增記錄發生例外異常", ex)); } }
public async Task EnableIt(FlowUserAdapterModel paraObject) { FlowUser itemData = Mapper.Map <FlowUser>(paraObject); CleanTrackingHelper.Clean <FlowUser>(context); FlowUser item = await context.FlowUser .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == paraObject.Id); if (item == null) { } else { item.Enable = true; context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <MenuData>(context); } }
public void Send(string username, string password) { user = new FlowUser(username, password); CommandProcessor.sendCommand(this); }
public async Task <VerifyRecordResult> AddAsync(FlowMasterAdapterModel paraObject) { try { CleanTrackingHelper.Clean <FlowMaster>(context); CleanTrackingHelper.Clean <FlowUser>(context); CleanTrackingHelper.Clean <FlowHistory>(context); CleanTrackingHelper.Clean <MyUser>(context); FlowMaster itemParameter = Mapper.Map <FlowMaster>(paraObject); CleanTrackingHelper.Clean <FlowMaster>(context); await context.FlowMaster .AddAsync(itemParameter); await context.SaveChangesAsync(); #region 產生要審核的使用者清單 var user = await context.MyUser .FirstOrDefaultAsync(x => x.Id == itemParameter.MyUserId); FlowUser auditUser = new FlowUser() { MyUserId = itemParameter.MyUserId, FlowMasterId = itemParameter.Id, Enable = true, Level = 0, OnlyCC = false, Name = "發文者", }; await context.FlowUser.AddAsync(auditUser); var policyDetails = await context.PolicyDetail .Where(x => x.PolicyHeaderId == paraObject.PolicyHeaderId) .OrderBy(x => x.Level) .ToListAsync(); foreach (var item in policyDetails) { if (item.Enable == false) { continue; } auditUser = new FlowUser() { MyUserId = item.MyUserId, FlowMasterId = itemParameter.Id, Enable = true, Level = item.Level, OnlyCC = item.OnlyCC, Name = item.Name, }; await context.FlowUser.AddAsync(auditUser); } itemParameter.NextMyUserName = user.Name; context.FlowMaster.Update(itemParameter); await context.SaveChangesAsync(); #endregion #region 增加簽核流程歷史紀錄 - 建立簽核表單 FlowHistory history = new FlowHistory() { FlowMasterId = itemParameter.Id, MyUserId = itemParameter.MyUserId, Approve = true, Summary = $"{user.Account} / {user.Name} 建立簽核表單", Comment = $"簽核單草稿", Updatetime = DateTime.Now, }; await context.FlowHistory.AddAsync(history); await context.SaveChangesAsync(); #endregion CleanTrackingHelper.Clean <FlowMaster>(context); CleanTrackingHelper.Clean <FlowUser>(context); CleanTrackingHelper.Clean <FlowHistory>(context); CleanTrackingHelper.Clean <MyUser>(context); return(VerifyRecordResultFactory.Build(true)); } catch (Exception ex) { Logger.LogError(ex, "新增記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "新增記錄發生例外異常", ex)); } }