112 lines
5.3 KiB
C#
112 lines
5.3 KiB
C#
|
|
using Ease.Core.DataAccess;
|
|||
|
|
using HRM.BO;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace HRM.DA
|
|||
|
|
{
|
|||
|
|
internal class PMSObjectiveProgressDA
|
|||
|
|
{
|
|||
|
|
#region Insert
|
|||
|
|
internal static void Insert(TransactionContext tc, PMSObjectiveProgress item)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL(
|
|||
|
|
@"INSERT INTO PMSOBJECTIVEPROGRESS (PMSOBJECTIVEPROGRESSID, OBJECTIVEID, EMPLOYEEID, DESCRIPTION, UPDATETIME, ACHIVEPERCENT, ISREAD, READTIME, ISEMPLOYEE, RATINGSTART, IsLmAchknowldged, fromEmpID)
|
|||
|
|
VALUES (%n, %n, %n, %s, %D, %n, %b, %D, %b, %n, %b, %n)",
|
|||
|
|
item.ID, item.ObjectiveID, item.EmployeeID, item.Description,
|
|||
|
|
item.UpdateTime, item.AchivePercent, item.IsRead, item.ReadTime,
|
|||
|
|
item.IsEmployee, item.RatingStart, item.IsLmAchknowldged, item.fromEmpID);
|
|||
|
|
tc.ExecuteNonQuery(sql);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion Insert
|
|||
|
|
|
|||
|
|
#region Update
|
|||
|
|
internal static void Update(TransactionContext tc, PMSObjectiveProgress item)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL(@"UPDATE PMSOBJECTIVEPROGRESS
|
|||
|
|
SET OBJECTIVEID = %n, EMPLOYEEID = %n, DESCRIPTION = %s, ACHIVEPERCENT = %n,
|
|||
|
|
ISREAD = %b, READTIME = %D, ISEMPLOYEE = %b, RATINGSTART = %b,
|
|||
|
|
IsLmAchknowldged= %b , fromEmpID=%n
|
|||
|
|
where PMSOBJECTIVEPROGRESSID = %n",
|
|||
|
|
item.ObjectiveID, item.EmployeeID,
|
|||
|
|
item.Description, item.AchivePercent, item.IsRead, item.ReadTime,
|
|||
|
|
item.IsEmployee, item.RatingStart, item.IsLmAchknowldged, item.fromEmpID, item.ID);
|
|||
|
|
tc.ExecuteNonQuery(sql);
|
|||
|
|
|
|||
|
|
//if(item.AchivePercent > 0)
|
|||
|
|
//{
|
|||
|
|
// tc.ExecuteNonQuery("Update Objective Set ProgressStatus=%n where ObjectiveID= %n", item.AchivePercent, item.ObjectiveID);
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
internal static void UpdateProgressStatus(TransactionContext tc, int objectiveID, double achivePercent)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery("Update Objective Set ProgressStatus=%n where ObjectiveID= %n", achivePercent, objectiveID);
|
|||
|
|
}
|
|||
|
|
internal static void UpdateReadTime(TransactionContext tc, PMSObjectiveProgress item)
|
|||
|
|
{
|
|||
|
|
tc.ExecuteNonQuery("UPDATE PMSOBJECTIVEPROGRESS Set ISREAD = %b, READTIME = %D where PMSOBJECTIVEPROGRESSID = %n", item.IsRead, item.ReadTime, item.ID);
|
|||
|
|
}
|
|||
|
|
#endregion Update
|
|||
|
|
|
|||
|
|
#region GetAll
|
|||
|
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESS");
|
|||
|
|
return tc.ExecuteReader(sql);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Get functions
|
|||
|
|
|
|||
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESS WHERE PMSOBJECTIVEPROGRESSID = %n", id);
|
|||
|
|
return tc.ExecuteReader(sql);
|
|||
|
|
}
|
|||
|
|
internal static IDataReader GetByObjectiveID(TransactionContext tc, int objectiveId)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESS WHERE ObjectiveID = %n order by UPDATETIME", objectiveId);
|
|||
|
|
return tc.ExecuteReader(sql);
|
|||
|
|
}
|
|||
|
|
internal static IDataReader GetUnreadMessage(TransactionContext tc, string objectiveIDs)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM PMSOBJECTIVEPROGRESS where isRead = %b and objectiveID in (%q)", false, objectiveIDs);
|
|||
|
|
return tc.ExecuteReader(sql);
|
|||
|
|
}
|
|||
|
|
internal static int GetUnreadEmployeeMessageCountByObjectiveSetID(TransactionContext tc, int objectiveSetID)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("SELECT COUNT(*) FROM PMSOBJECTIVEPROGRESS where isRead = %b AND isEmployee = 1 and objectiveID in (SELECT OBJECTIVEID FROM OBJECTIVE WHERE OBJECTIVESETID = %n AND OBJECTIVESTATUS<>%n)", false, objectiveSetID, EnumObjectiveStatus.Removed);
|
|||
|
|
object count = tc.ExecuteScalar(sql);
|
|||
|
|
|
|||
|
|
if (count == DBNull.Value || count == null)
|
|||
|
|
return 0;
|
|||
|
|
else
|
|||
|
|
return Convert.ToInt32(count);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
internal static DataTable GetEmpProgress(TransactionContext tc, int pmpYearID)
|
|||
|
|
{
|
|||
|
|
return tc.ExecuteDataTable(@"Select e.EmployeeID, e.EmployeeNo, e.Name, e.JoiningDate, d.DESCRIPTION Department, des.NAME Designation,
|
|||
|
|
DATEDIFF(mm, e.JOININGDATE, GetDate()) ServiceLength, '' LastYearRating, obs.ProgressStatus from EMPLOYEE e
|
|||
|
|
join OBJECTIVESET obs on e.EMPLOYEEID = obs.EMPLOYEEID
|
|||
|
|
join DEPARTMENT d on d.DEPARTMENTID = e.DEPARTMENTID
|
|||
|
|
join DESIGNATION des on des.DESIGNATIONID = e.DESIGNATIONID
|
|||
|
|
where obs.PMPYEARID = %n order by e.EMPLOYEENO", pmpYearID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Delete
|
|||
|
|
internal static void DeleteByObjectiveID(TransactionContext tc, int objectiveID)
|
|||
|
|
{
|
|||
|
|
string sql = SQLParser.MakeSQL("Delete From PMSOBJECTIVEPROGRESS Where ObjectiveID = %n", objectiveID);
|
|||
|
|
tc.ExecuteNonQuery(sql);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|