You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.8 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
}
}
}