You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
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<DbBackupEntity> GetList(string queryJson)
|
|
{
|
|
var expression = ExtLinq.True<DbBackupEntity>();
|
|
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);
|
|
}
|
|
}
|
|
}
|