1
This commit is contained in:
97
00.SDK/E_ZKEccSDK/Service/DepartmentService.cs
Normal file
97
00.SDK/E_ZKEccSDK/Service/DepartmentService.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using E_ZKEcc;
|
||||
using E_ZKEcc.Domian;
|
||||
using E_ZKEccSDK.Request;
|
||||
using E_ZKEccSDK.Response;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace E_ZKEccSDK.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(DepartmentUpdateRequest request)
|
||||
{
|
||||
_actionName = "update";
|
||||
|
||||
try
|
||||
{
|
||||
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<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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user