103 lines
2.7 KiB
C#
103 lines
2.7 KiB
C#
using E_ZKEcc;
|
|
using E_ZKEcc.Domian;
|
|
using E_ZKEcc.Request;
|
|
using E_ZKEcc.Response;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace E_ZKEcc.Service
|
|
{
|
|
public class DepartmentService : BaseService
|
|
{
|
|
public DepartmentService(ApiInfoDomian apiInfo) : base(apiInfo, "department")
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除部门
|
|
/// </summary>
|
|
/// <param name="deptnumber"></param>
|
|
/// <returns></returns>
|
|
public ResultDomian DeleteDepartment(string deptnumber)
|
|
{
|
|
_actionName = "delete";
|
|
|
|
try
|
|
{
|
|
var request = new { deptnumber };
|
|
|
|
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
|
|
|
var resultJson = this.DoExecute(dataJson);
|
|
|
|
var result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新部门
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
public ResultDomian UpdateDepartment(List<DepartmentUpdateRequest> list)
|
|
{
|
|
_actionName = "update";
|
|
|
|
try
|
|
{
|
|
var dataJson = JsonConvert.SerializeObject(list, Formatting.None, _serializerSettings);
|
|
|
|
var resultJson = this.DoExecute(dataJson);
|
|
|
|
var result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public ResultDomian UpdateDepartment(DepartmentUpdateRequest request)
|
|
{
|
|
return UpdateDepartment(new List<DepartmentUpdateRequest>() { request });
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取部门信息
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
public ResultDomian<DepartmentGetResponse> GetDepartment(DepartmentGetRequest request)
|
|
{
|
|
_actionName = "get";
|
|
|
|
try
|
|
{
|
|
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
|
|
|
var resultJson = this.DoExecute(dataJson);
|
|
|
|
var result = JsonConvert.DeserializeObject<ResultDomian<DepartmentGetResponse>>(resultJson);
|
|
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
}
|
|
}
|