This package provides functionality for communicating with ZKTeco devices. It includes easy methods and built-in attendance models along with other frequently used methods such as CRUD operations for users and Read, Delete. Note: This package is designed for .NET Standard 2.0 and may not work with .NET 7. For other customization like scheduling data retrieval, deletion, and other project integration work, contact: Email: gauravmaharjan000@gmail.com LinkedIn: https://www.linkedin.com/in/gaurav-maharjan-550042215/
$ dotnet add package BiometricZktecoDeviceCommunicationThis package provides functionality for communicating with ZKTeco devices. It includes easy methods and built-in attendance models along with other frequently used methods such as CRUD operations for users and Read, Delete.
Install the package via NuGet:
powershell
Install-Package ZKTecoDeviceCommunication
#Usage Here is an example of how to use the package in an ASP.NET Core application:
Configure Services In Startup.cs or Program.cs (depending on your project setup), add the following service configuration: builder.Services.AddScoped<IZKTecoAttendance_DataFetchBL, ZKTecoAttendance_DataFetchBL>();
Create a Controller Create a controller that uses the IZKTecoAttendance_DataFetchBL service. Below is an example implementation: using Attendance_ZKTeco_Service.Interfaces; using AttendanceFetch.Models; using biometricApplicationNugetPackageIntegration.Models; using Microsoft.AspNetCore.Mvc; using System.Diagnostics;
namespace biometricApplicationNugetPackageIntegration.Controllers { public class HomeController : Controller { private readonly ILogger<HomeController> _logger; private readonly IZKTecoAttendance_DataFetchBL _ztecoAttendance_DataFetchBL;
public HomeController(ILogger<HomeController> logger, IZKTecoAttendance_DataFetchBL ztecoAttendance_DataFetchBL)
{
_logger = logger;
_ztecoAttendance_DataFetchBL = ztecoAttendance_DataFetchBL;
}
public async Task<IActionResult> Index()
{
var model = new AttendanceDevice
{
Id = 1,
AttendanceDeviceTypeId = 1,
DeviceTypeName = "zkteco",
ModelNo = "string",
DeviceMachineNo = 1,
IPAddress = "192.168.20.19",
Port = 4370,
StatusChgUserId = 0,
ClientAlias = "admin"
};
var result = await _ztecoAttendance_DataFetchBL.GetData_Zkteco(model);
if (result.ResultType == ResultType.Success)
{
// Handle success
Console.WriteLine("Data retrieved successfully!");
foreach (var machineInfo in result.Data)
{
// Process each MachineInfo item
Console.WriteLine($"Machine Info: {machineInfo}");
}
}
else
{
// Handle failure
Console.WriteLine($"Failed to retrieve data: {result.Message}");
}
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
For other customization like scheduling data retrieval, deletion, and other project integration work, contact:
LinkedIn: Gaurav Maharjan License This project is licensed under the MIT License.
This README.md file provides a comprehensive guide on how to install, configure, and use the ZKTecoDeviceCommunication package, including example code for integrating the service into an ASP.NET Core application.