|
|
using System.Collections;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Models;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:不良代码维护
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class DefectCodeService : BaseService<SysDefect>, IDefectCodeService
|
|
|
{
|
|
|
private readonly IDefectCodeRepository repository;
|
|
|
public DefectCodeService(IDefectCodeRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
public Hashtable GetDefectCodeWhere( Pager pager)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
string whereStr = "enabled = 'Y'";
|
|
|
return repository.GetDefectCodeWhere(whereStr, pager);
|
|
|
|
|
|
}
|
|
|
|
|
|
public bool UpdateById(SysDefect param)
|
|
|
{
|
|
|
return repository.UpdateDefect(param);
|
|
|
}
|
|
|
|
|
|
public bool AddDefect(SysDefect htParams)
|
|
|
{
|
|
|
return repository.AddDefect(htParams);
|
|
|
}
|
|
|
|
|
|
public Hashtable GetDefectById(int defect_id)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
string whereStr = string.Format("defect_id = {0}", defect_id);
|
|
|
Pager pager = new Pager();
|
|
|
pager.pageNo = 1;
|
|
|
pager.pageSize = 10;
|
|
|
//string whereStr = string.Format( "[enabled] = '{0}'");
|
|
|
return repository.GetDefectCodeWhere(whereStr, pager);
|
|
|
}
|
|
|
|
|
|
public bool DeleteDefectById(int defect_id)
|
|
|
{
|
|
|
return repository.DeleteDefectById(defect_id);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int EnableData(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.EnableData(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int DisableData(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.DisableData(id);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
}
|
|
|
}
|