private async Task <int> MigrateSystemSettings() { List <SystemSetting> records = sqlDataContext.SystemSettings.ToList(); SystemSettingRepository repository = new SystemSettingRepository(); int recCount = 0; try { // delete all existing records from Postgres Database postgressDataContext.SystemSettings.RemoveRange(postgressDataContext.SystemSettings); await postgressDataContext.SaveChangesAsync(); // Migrage SQL Server data into Postgress database foreach (SystemSetting rec in records) { postgressDataContext.SystemSettings.Add(rec); } await postgressDataContext.SaveChangesAsync(); //await UpdateSystemSettings(); recCount = records.Count; } catch (Exception exp) { MessageBox.Show($"Error while migrating System Settings. The error is {Environment.NewLine}Main Exception: {exp.Message}{Environment.NewLine}Inner Exception: {exp.InnerException?.Message}"); } return(recCount); }
public AllocationsMessengerServiceProcessor() { allocationService = new AllocationRepository(); empService = new EmployeeRepository(); settingRepository = new SystemSettingRepository(); logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); log4net.Config.XmlConfigurator.Configure(); }
/// <summary> /// 更新信息信息 /// </summary> /// <param name="inputDtos">包含更新信息的信息DTO信息</param> /// <returns>业务操作结果</returns> public OperationResult EditSystemSettings(params SystemSettingInputDto[] inputDtos) { return(SystemSettingRepository.Update(inputDtos, (dto, entity) => { }, (dto, entity) => { return entity; })); }
/// <summary> /// 添加店铺信息信息 /// </summary> /// <param name="inputDtos">要添加的店铺信息DTO信息</param> /// <returns>业务操作结果</returns> public OperationResult AddSystemSettings(params SystemSettingInputDto[] inputDtos) { return(SystemSettingRepository.Insert(inputDtos, dto => { if (SystemSettingRepository.CheckExists(ss => ss.Key == dto.Key)) { throw new Exception("设置项目:{0}已经存在,不能添加同名设置".FormatWith(dto.Key)); } }, (dto, entity) => { return entity; })); }
public AllocationsUpdaterServiceProcessor() { logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); log4net.Config.XmlConfigurator.Configure(); allocationRepo = new AllocationRepository(); employeeRepo = new EmployeeRepository(); projectRepo = new ProjectRepository(); trackerRepo = new NotificationsTrackerRepository(); practiceRepository = new PracticeRepository(); settingRepository = new SystemSettingRepository(); emailClientIP = ProcessorHelper.GetSettingsValue(ProcessorHelper.EMAIL_PROXY_SERVER); ownerEmailID = ProcessorHelper.GetSettingsValue(ProcessorHelper.CONTRACTOR_REQ_EMAIL_OWNER); outlookPwd = ProcessorHelper.GetSettingsValue(ProcessorHelper.EMAIL_OWNERS_PASSWORD); }
/// <summary> /// 删除信息信息 /// </summary> /// <param name="ids">要删除的信息编号</param> /// <returns>业务操作结果</returns> public OperationResult DeleteSystemSettings(params int[] ids) { return(SystemSettingRepository.Delete(ids)); }
/// <summary> /// 检查店信息是否存在 /// </summary> /// <param name="predicate">检查谓语表达式</param> /// <param name="id">更新的信息编号</param> /// <returns>信息是否存在</returns> public bool CheckSystemSettingExists(Expression <Func <SystemSetting, bool> > predicate, int id = 0) { return(SystemSettingRepository.CheckExists(predicate, id)); }
public UnitOfWork(ApplicationDbContext db) { _db = db; SystemSetting = new SystemSettingRepository(_db); Users = new UserRepository(_db); }
static ProcessorHelper() { settingsRepo = new SystemSettingRepository(); systemSettings = settingsRepo.GetAll().ToList(); }