using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Ease.CoreV35.DataAccess; using Payroll.BO; using Ease.CoreV35.Model; namespace Payroll.Service { public class EmployeeAppraisalDA { internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) { return tc.ExecuteReader("Select * From EmployeeAppraisal"); } else { return tc.ExecuteReader("Select * From EmployeeAppraisal Where status = %n",Convert.ToInt32(status)); } } internal static IDataReader Get(TransactionContext tc, DateTime appYear) { return tc.ExecuteReader("Select * From EmployeeAppraisal where AppraisalYear=%d", Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(appYear)); } internal static void Insert(TransactionContext tc, EmployeeAppraisal item) { tc.ExecuteNonQuery("Insert into EmployeeAppraisal(EmployeeAppraisalID, EmployeeID, AppraisalYear, MKTSurveyID, CurrentBasic, SurveyON, BudgetAmount, " + " MKTAmount, LMID, LMChangePercent, LMChangeAmount, LMRemarks, ISLMDone, ISHRDone, HRApproveID, HRChangePercent, HRChangeAmount, " + " HRRemarks, AppraisalPointID, AppraisalPointRate, CreatedDate, CreatedBy) " + " Values(%n, %n, %d, %n, %n, %n, %n, %n, %n, %n, %n, %s, %n, %n, %n, %n, %n, %s, %n, %n, %d, %n)", item.ID.Integer, item.EmployeeID.Integer, item.AppraisalYear, DataReader.GetNullValue(item.MKTSurveyID, IDType.Integer), item.CurrentBasic, item.SurveyON, item.BudgetAmount, item.MKTAmount, DataReader.GetNullValue(item.LMID, IDType.Integer), item.LMChangePercent, item.LMChangeAmount, item.LMRemarks, item.ISLMDone, item.ISHRDone, DataReader.GetNullValue(item.HRApproveID, IDType.Integer), item.HRChangePercent, item.HRChangeAmount, item.HRRemarks, DataReader.GetNullValue(item.AppraisalPointID,IDType.Integer) , item.AppraisalPointRate, item.CreatedDate, item.CreatedBy.Integer); } internal static void Update(TransactionContext tc, EmployeeAppraisal item) { tc.ExecuteNonQuery("Update EmployeeAppraisal Set EmployeeID = %n , AppraisalYear = %d , MKTSurveyID = %n , CurrentBasic = %n , " +" SurveyON = %n , BudgetAmount = %n , MKTAmount = %n , LMID = %n ,LMChangePercent = %n , LMChangeAmount = %n , " +" LMRemarks = %s, ISLMDone = %n , ISHRDone = %n, HRApproveID = %n ,HRChangePercent = %n,HRChangeAmount = %n, " +" HRRemarks = %s,AppraisalPointID = %n,AppraisalPointRate = %n,CreatedDate = %d,CreatedBy = %n " +" Where EmployeeAppraisalID = %n", item.EmployeeID.Integer, item.AppraisalYear, item.MKTSurveyID.Integer, item.CurrentBasic, Convert.ToInt32(item.SurveyON), item.BudgetAmount, item.MKTAmount, DataReader.GetNullValue(item.LMID, IDType.Integer), item.LMChangePercent, item.LMChangeAmount, item.LMRemarks, item.ISLMDone, item.ISHRDone, DataReader.GetNullValue(item.HRApproveID, IDType.Integer), item.HRChangePercent, item.HRChangeAmount, item.HRRemarks, item.AppraisalPointID.Integer, item.AppraisalPointRate, item.ModifiedDate , item.ModifiedBy.Integer, item.ID.Integer); } internal static void Delete(TransactionContext tc,ID id) { tc.ExecuteNonQuery("Delete From EmployeeAppraisal Where EmployeeAppraisalID = %n", id.Integer); } } }