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#

2 years ago
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;
}
}
}