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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
141
00.SDK/E_ZKEccSDK/Service/EmployeeService.cs
Normal file
141
00.SDK/E_ZKEccSDK/Service/EmployeeService.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using E_ZKEcc.Domian;
|
||||
using ExtensionMethods;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using E_ZKEccSDK.Response;
|
||||
using E_ZKEccSDK.Request;
|
||||
|
||||
namespace E_ZKEcc.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员对接
|
||||
/// </summary>
|
||||
public class EmployeeService : BaseService
|
||||
{
|
||||
public EmployeeService(ApiInfoDomian apiInfo) : base(apiInfo, "employee")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region 人员更新
|
||||
/// <summary>
|
||||
/// 人员更新
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian UpdateEmployee(List<EmployeeUpdateRequest> list)
|
||||
{
|
||||
_actionName = "update";
|
||||
ResultDomian result;
|
||||
try
|
||||
{
|
||||
var dataJson = JsonConvert.SerializeObject(list, Formatting.None, _serializerSettings);
|
||||
|
||||
var resultJson = this.DoExecute(dataJson);
|
||||
|
||||
result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 人员离职
|
||||
/// <summary>
|
||||
/// 人员离职
|
||||
/// </summary>
|
||||
/// <param name="pin">人员编号</param>
|
||||
/// <param name="leavedate">离职日期 yyyy-MM-dd HH:MM</param>
|
||||
/// <param name="leavetype">离职类型 0 自离 1 辞退 2 辞职 3 调离 4 停薪留职 5 退休 6 死亡</param>
|
||||
/// <param name="reason">离职原因</param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian LeaveEmployee(string pin, string leavedate, int leavetype, string reason = null)
|
||||
{
|
||||
_actionName = "leave";
|
||||
ResultDomian result;
|
||||
try
|
||||
{
|
||||
object data = new
|
||||
{
|
||||
pin,
|
||||
leavedate,
|
||||
leavetype,
|
||||
reason
|
||||
};
|
||||
|
||||
var dataJson = JsonConvert.SerializeObject(data, Formatting.None, _serializerSettings);
|
||||
|
||||
var resultJson = this.DoExecute(dataJson);
|
||||
|
||||
result = JsonConvert.DeserializeObject<ResultDomian>(resultJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人员离职
|
||||
/// </summary>
|
||||
/// <param name="pin">人员编号</param>
|
||||
/// <param name="leavedate">离职日期 yyyy-MM-dd HH:MM</param>
|
||||
/// <param name="leavetype">离职类型 0 自离 1 辞退 2 辞职 3 调离 4 停薪留职 5 退休 6 死亡</param>
|
||||
/// <param name="reason">离职原因</param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian LeaveEmployee(string pin, DateTime leavedate, int leavetype, string reason = null)
|
||||
{
|
||||
return LeaveEmployee(pin, leavedate.ToString("yyyy-MM-dd HH:MM"), leavetype, reason);
|
||||
}
|
||||
#endregion 人员离职
|
||||
|
||||
#region 获取人员信息
|
||||
/// <summary>
|
||||
/// 获取人员信息
|
||||
/// </summary>
|
||||
/// <param name="pinlist"></param>
|
||||
/// <param name="offduty"></param>
|
||||
/// <param name="deptnumberlist"></param>
|
||||
/// <param name="fetch_child"></param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian<EmployeeGetResponse> GetEmployee(string pinlist, int offduty = 2, string deptnumberlist = null, int fetch_child = 0)
|
||||
{
|
||||
_actionName = "get";
|
||||
|
||||
try
|
||||
{
|
||||
var data = new EmployeeGetRequest
|
||||
{
|
||||
pinlist = pinlist,
|
||||
offduty = offduty,
|
||||
deptnumberlist = deptnumberlist,
|
||||
fetch_child = fetch_child
|
||||
};
|
||||
|
||||
var dataJson = JsonConvert.SerializeObject(data, Formatting.None, _serializerSettings);
|
||||
|
||||
var resultJson = this.DoExecute(dataJson);
|
||||
|
||||
var result = JsonConvert.DeserializeObject<ResultDomian<EmployeeGetResponse>>(resultJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
105
00.SDK/E_ZKEccSDK/Service/TransactionService.cs
Normal file
105
00.SDK/E_ZKEccSDK/Service/TransactionService.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
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_ZKEcc.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 记录对接
|
||||
/// </summary>
|
||||
public class TransactionService : BaseService
|
||||
{
|
||||
public TransactionService(ApiInfoDomian apiInfo) : base(apiInfo, "transaction")
|
||||
{
|
||||
|
||||
}
|
||||
#region 获取考勤记录
|
||||
|
||||
/// <summary>
|
||||
/// 获取考勤记录
|
||||
/// </summary>
|
||||
/// <param name="starttime">必填 开始时间 开始时间结束时间跨度不得超过一个月 格式:%Y-%m-%d %H:%M:%S 示例:2018-04-25 00:00:01</param>
|
||||
/// <param name="endtime">必填 结束时间</param>
|
||||
/// <param name="pin">人员编号</param>
|
||||
/// <param name="sn">设备序列号</param>
|
||||
/// <param name="id">记录流水号 1.建议同步考勤记录到第三方数据库时使用id 2.记录流水号自动递增 3.存在id或number时,开始时间和结束时间可为非必选参数</param>
|
||||
/// <param name="number">每次请求获取的记录数,建议控制在每次2000条以内</param>
|
||||
/// <param name="uploadPic">是否传考勤照片 1.是 0.否</param>
|
||||
/// <param name="getTemperature">是否传体温与是否佩戴口罩 1.是 0.否</param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian<TransactionGetResponse> GetTransaction(string starttime, string endtime, string pin = null, string sn = null, long? id = null, int? number = null, int? uploadPic = null, int? getTemperature = null)
|
||||
{
|
||||
_actionName = "get";
|
||||
try
|
||||
{
|
||||
var request = new TransactionGetRequest();
|
||||
request.starttime = starttime;
|
||||
request.endtime = endtime;
|
||||
request.pin = pin;
|
||||
request.sn = sn;
|
||||
request.id = id;
|
||||
request.number = number;
|
||||
request.uploadPic = uploadPic;
|
||||
request.getTemperature = getTemperature;
|
||||
|
||||
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
||||
|
||||
var resultJson = this.DoExecute(dataJson);
|
||||
|
||||
var result = JsonConvert.DeserializeObject<ResultDomian<TransactionGetResponse>>(resultJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取考勤记录
|
||||
/// </summary>
|
||||
/// <param name="starttime">必填 开始时间 开始时间结束时间跨度不得超过一个月 格式:%Y-%m-%d %H:%M:%S 示例:2018-04-25 00:00:01</param>
|
||||
/// <param name="endtime">必填 结束时间</param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian<TransactionGetResponse> GetTransaction(DateTime starttime, DateTime endtime)
|
||||
{
|
||||
return GetTransaction(starttime.ToString("yyyy-MM-dd HH:MM"), endtime.ToString("yyyy-MM-dd HH:MM"));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取考勤记录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public ResultDomian<TransactionGetResponse> GetTransaction(TransactionGetRequest request)
|
||||
{
|
||||
_actionName = "get";
|
||||
try
|
||||
{
|
||||
var dataJson = JsonConvert.SerializeObject(request, Formatting.None, _serializerSettings);
|
||||
|
||||
var resultJson = this.DoExecute(dataJson);
|
||||
|
||||
var result = JsonConvert.DeserializeObject<ResultDomian<TransactionGetResponse>>(resultJson);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user