using NFine.Code; using NFine.Domain.Entity.SystemSecurity; using NFine.Domain.IRepository.SystemSecurity; using NFine.Repository.SystemSecurity; using System; using System.Collections.Generic; using System.Linq; namespace NFine.Application.SystemSecurity { public class DbBackupApp { private IDbBackupRepository service = new DbBackupRepository(); public List GetList(string queryJson) { var expression = ExtLinq.True(); var queryParam = queryJson.ToJObject(); if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { string condition = queryParam["condition"].ToString(); string keyword = queryParam["keyword"].ToString(); switch (condition) { case "DbName": expression = expression.And(t => t.F_DbName.Contains(keyword)); break; case "FileName": expression = expression.And(t => t.F_FileName.Contains(keyword)); break; } } return service.IQueryable(expression).OrderByDescending(t => t.F_BackupTime).ToList(); } public DbBackupEntity GetForm(string keyValue) { return service.FindEntity(keyValue); } public void DeleteForm(string keyValue) { service.DeleteForm(keyValue); } public void SubmitForm(DbBackupEntity dbBackupEntity) { dbBackupEntity.F_Id = Common.GuId(); dbBackupEntity.F_EnabledMark = true; dbBackupEntity.F_BackupTime = DateTime.Now; service.ExecuteDbBackup(dbBackupEntity); } } }