using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { #region CarFuelParameterIndividualDA public class CarFuelParameterIndividualDA { #region Constructor public CarFuelParameterIndividualDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, CarFuelParameterIndividual oItem) { string strSQL = SQLParser.MakeSQL(@"INSERT INTO CarFuelParameterIndividual (CarFuelParameterIndividualID, ArrearType, EmployeeId, FromDate, ToDate, IndividualType, CarFuelItemId, CarFuelParameterId, CarFuelPeriodicity, Value, ValueType, CreatedBy, CreationDate,PayrollTypeID) VALUES(%n, %n, %n, %d, %d, %n, %n, %n, %n, %n, %n, %n, %d,%n)", oItem.ID.Integer, oItem.ArrearType, oItem.EmployeeId.Integer, oItem.FromDate, DataReader.GetNullValue(oItem.ToDate), oItem.IndividualType, oItem.CarFuelItemId.Integer, oItem.CarFuelParameterID.Integer, oItem.CarFuelPeriodicity, oItem.Value, oItem.ValueType, DataReader.GetNullValue(oItem.CreatedBy.Integer), DataReader.GetNullValue(oItem.CreatedDate),SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); tc.ExecuteNonQuery(strSQL); } #endregion #region Update function internal static void Update(TransactionContext tc, CarFuelParameterIndividual oItem) { tc.ExecuteNonQuery( @"UPDATE CarFuelParameterIndividual SET ArrearType=%n, EmployeeId=%n, FromDate=%d, ToDate=%d, IndividualType=%n, CarFuelItemId=%n, CarFuelParameterId=%n, CarFuelPeriodicity=%n, Value=%n, ValueType=%n, ModifiedBy=%n, ModifiedDate=%d,PayrollTypeID = %n WHERE CarFuelParameterIndividualID=%n", oItem.ArrearType, oItem.EmployeeId.Integer, oItem.FromDate, DataReader.GetNullValue(oItem.ToDate), oItem.IndividualType, oItem.CarFuelItemId.Integer, oItem.CarFuelParameterID.Integer, oItem.CarFuelPeriodicity, oItem.Value, oItem.ValueType, DataReader.GetNullValue(oItem.ModifiedBy.Integer), DataReader.GetNullValue(oItem.ModifiedDate), SystemInformation.CurrentSysInfo.PayrollTypeID.Integer,oItem.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM CarFuelParameterIndividual"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM CarFuelParameterIndividual WHERE CarFuelParameterIndividualID =%n", nID.Integer); } internal static IDataReader GetByParameterID(TransactionContext tc, ID nParameterID) { return tc.ExecuteReader("SELECT * FROM CarFuelParameterIndividual WHERE CarFuelParameterID =%n", nParameterID.Integer); } internal static IDataReader GetIndividuals(TransactionContext tc, ID nCarFuelPAramID, EnumCarFuelIndivdualType type) { return tc.ExecuteReader("SELECT * FROM CarFuelParameterIndividual WHERE CarFuelParameterID=%n AND IndividualType=%n", nCarFuelPAramID.Integer, type); } internal static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime toDate) { return tc.ExecuteReader("SELECT CarFuel.* FROM CarFuelParameter OP, CarFuelParameterIndividual CarFuel " + " WHERE OP.CarFuelParameterID=CarFuel.CarFuelParameterID AND CarFuel.IndividualType=%n AND OP.IsActive <> 0 " + " AND ( (CarFuel.ToDate >= %d OR CarFuel.ToDate IS Null) AND " + " (CarFuel.FromDate <= %d))", EnumCarFuelIndivdualType.AppliedToIndividual, fromDate, toDate); } #endregion #region Delete function internal static void DeletebyCarFuelParamId(TransactionContext tc, ID nCarFuelParamID) { tc.ExecuteNonQuery("DELETE FROM CarFuelParameterIndividual WHERE CarFuelParameterID=%n", nCarFuelParamID.Integer); } internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [CarFuelParameterIndividual] WHERE CarFuelParameterIndividualID=%n", nID.Integer); } #endregion } #endregion }