149 lines
6.7 KiB
C#
149 lines
6.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.CoreV35.DataAccess;
|
|
using System.Data;
|
|
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
class EmpMobileDA
|
|
{
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader(@"select * from EMPMOBILE where EmpMobID=%n", id);
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, bool isActive)
|
|
{
|
|
return tc.ExecuteReader(@"SELECT * FROM EMPMOBILE WHERE IsActive=%b", isActive);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, string DeviceNo)
|
|
{
|
|
return tc.ExecuteReader(@"select * from EMPMOBILE where DeviceNo=%s", DeviceNo);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader(@"select * from EMPMOBILE");
|
|
}
|
|
|
|
internal static IDataReader GetByEmployeeID(TransactionContext tc, int employeeID)
|
|
{
|
|
return tc.ExecuteReader(@"select * from EMPMOBILE where empID =%n", employeeID);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int EmployeeID, string DeviceNo)
|
|
{
|
|
return tc.ExecuteReader(@"select * from EMPMOBILE where empID =%n and DeviceNo=%s and IsActive=1",
|
|
EmployeeID, DeviceNo);
|
|
}
|
|
|
|
|
|
internal static int Insert(TransactionContext tc, EmpMobile empAttend)
|
|
{
|
|
tc.ExecuteNonQuery(@"insert into EMPMOBILE(EmpMobID,EmpID,DeviceNo,CreatedBy,CreationDate, IsActive)
|
|
values(%n,%n,%s,%n,%d,%b)", empAttend.ID, empAttend.EmpID, empAttend.DeviceNO,
|
|
empAttend.CreatedBy, empAttend.CreatedDate, empAttend.IsActive);
|
|
return empAttend.ID;
|
|
}
|
|
|
|
internal static int Delete(TransactionContext tc, EmpMobile empAttend)
|
|
{
|
|
tc.ExecuteNonQuery(@"delete from EMPMOBILE where EmpMobID=%n", empAttend.ID);
|
|
return empAttend.ID;
|
|
}
|
|
internal static void Delete(TransactionContext tc, string ids)
|
|
{
|
|
tc.ExecuteNonQuery(@"delete from EMPMOBILE where EmpMobID IN (%q)", ids);
|
|
}
|
|
internal static int Update(TransactionContext tc, EmpMobile empAttend)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
@"update EMPMOBILE set EmpID=%n,DeviceNo=%s,CreatedBy=%n,CreationDate=%d,ModifiedBy=%n,ModifiedDate=%d where EmpMobID=%n ",
|
|
empAttend.EmpID, empAttend.DeviceNO, empAttend.CreatedBy, empAttend.CreatedDate, empAttend.ModifiedBy,
|
|
empAttend.ModifiedDate, empAttend.ID);
|
|
return empAttend.ID;
|
|
}
|
|
internal static void Update(TransactionContext tc, string ids)
|
|
{
|
|
string sql = SQLParser.MakeSQL(@"update EMPMOBILE set IsActive=1 where EmpMobID IN (%q) ", ids);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
internal static DataSet GetEmpForMobileLogin(TransactionContext tc, int EmployeeID)
|
|
{
|
|
string strSQLQuery = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID, e.EMPLOYEENO, e.NAME, e.STATUS, e.PAYROLLTYPEID, d.NAME Designation
|
|
FROM EMPLOYEE e
|
|
LEFT JOIN DESIGNATION d ON e.DESIGNATIONID = d.DESIGNATIONID
|
|
WHERE e.EMPLOYEEID = %n", EmployeeID);
|
|
|
|
return tc.ExecuteDataSet(strSQLQuery);
|
|
}
|
|
|
|
internal static DataSet GetEmpForMobileLogin(TransactionContext tc, string DeviceNo)
|
|
{
|
|
string strSQLQuery = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID, e.EMPLOYEENO, e.NAME, e.EmailAddress, e.STATUS, e.PAYROLLTYPEID,
|
|
e.ENDOFCONTRACTDATE, d.NAME Designation, em.EmpMobID ValidMobile, em.IsActive
|
|
FROM EMPLOYEE e
|
|
LEFT JOIN DESIGNATION d ON e.DESIGNATIONID = d.DESIGNATIONID
|
|
INNER JOIN EMPMOBILE em ON e.EmployeeID = em.EmpID
|
|
WHERE DeviceNo = %s AND IsActive = 1 ", DeviceNo);
|
|
|
|
|
|
return tc.ExecuteDataSet(strSQLQuery);
|
|
}
|
|
|
|
|
|
internal static DataSet GetEmpForMobileLogin(TransactionContext tc, string DeviceNo, int EmployeeID)
|
|
{
|
|
string strSQLQuery = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID, e.EMPLOYEENO, e.NAME, e.EmailAddress, e.STATUS, e.PAYROLLTYPEID,
|
|
e.ENDOFCONTRACTDATE, d.NAME Designation, em.EmpMobID ValidMobile, em.IsActive
|
|
FROM EMPLOYEE e
|
|
LEFT JOIN DESIGNATION d ON e.DESIGNATIONID = d.DESIGNATIONID
|
|
LEFT JOIN EMPMOBILE em ON e.EmployeeID = em.EmpID
|
|
WHERE e.EMPLOYEEID = (Select EmpID from EMPMOBILE Where DeviceNo=%s and EmpID=%n)", DeviceNo, EmployeeID);
|
|
|
|
|
|
return tc.ExecuteDataSet(strSQLQuery);
|
|
}
|
|
|
|
internal static DataSet GetEmpForMobileLoginByEmpNo(TransactionContext tc, string EmpNo)
|
|
{
|
|
string strSQLQuery = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID, e.EMPLOYEENO, e.NAME, e.EmailAddress, e.STATUS, e.PAYROLLTYPEID, e.ENDOFCONTRACTDATE, d.NAME Designation, em.EmpMobID ValidMobile, em.IsActive
|
|
FROM EMPLOYEE e
|
|
LEFT JOIN DESIGNATION d ON e.DESIGNATIONID = d.DESIGNATIONID
|
|
LEFT JOIN EMPMOBILE em ON e.EmployeeID = em.EmpID
|
|
WHERE e.EMPLOYEENO = %s", EmpNo);
|
|
|
|
|
|
return tc.ExecuteDataSet(strSQLQuery);
|
|
}
|
|
|
|
internal static DataSet getActiveDevice(TransactionContext tc, bool isActive)
|
|
{
|
|
string strSQLQuery = SQLParser.MakeSQL(@"
|
|
SELECT
|
|
e.EMPLOYEENO,
|
|
e.NAME,
|
|
em.EmpMobID,
|
|
em.DeviceNo,
|
|
em.CREATIONDATE,
|
|
CASE
|
|
WHEN em.IsActive = 1 THEN 1
|
|
ELSE 0
|
|
END AS IsActive
|
|
FROM EMPMOBILE em
|
|
LEFT JOIN EMPLOYEE e ON em.EmpID = e.EMPLOYEEID
|
|
WHERE em.IsActive = %b",
|
|
isActive);
|
|
return tc.ExecuteDataSet(strSQLQuery);
|
|
}
|
|
|
|
internal static void UnRegisterUserDevice(TransactionContext tc, int EmpID, string DeviceNo)
|
|
{
|
|
tc.ExecuteNonQuery(@"Delete from EMPMOBILE where EmpID = %n AND DeviceNo = %s ", EmpID, DeviceNo);
|
|
}
|
|
}
|
|
} |