using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA.Fund { internal class ProjectProcessDA { public ProjectProcessDA() { } #region Insert Function internal static void Insert(TransactionContext tc, ProjectProcess oProjectProcess) { string sql = SQLParser.MakeSQL( "INSERT INTO ProjectProcess (ProcessID, ProjectID, Description, TranTypeID, Category, MapSubObjectName_1, MapSubObjectName_2, FasSubTranObjectName, ActivityRelatedSourceID, IsTEReqForVoucher, CreatedBy, CreatedDate, ModifiedBy, ModifiedDate)" + " VALUES(%n, %n, %s, %n, %n, %s, %s, %s, %n, %b, %n, %D, %n, %D)", oProjectProcess.ID, oProjectProcess.CurrentProjectID, oProjectProcess.Description, oProjectProcess.TranType, oProjectProcess.Category, oProjectProcess.MapSubsidiaryObjectName_1, DataReader.GetNullValue(oProjectProcess.MapSubsidiaryObjectName_2), oProjectProcess.FasSubsidiaryTranObjectName, DataReader.GetNullValue(oProjectProcess.ActivityRelatedSourceObjID), oProjectProcess.IsTranElementRequiredForVoucher, oProjectProcess.CreatedBy, oProjectProcess.CreatedDate, oProjectProcess.ModifiedBy, oProjectProcess.ModifiedDate); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, ProjectProcess oProjectProcess) { string sql = SQLParser.MakeSQL("UPDATE ProjectProcess Set ProjectID = %n, Description = %s," + " TranTypeID=%n, Category=%n, MapSubObjectName_1=%s, MapSubObjectName_2=%s," + " FasSubTranObjectName=%s, ActivityRelatedSourceID=%n, IsTEReqForVoucher=%b," + " ModifiedBy = %n, ModifiedDate = %D" + "WHERE ProcessID = %n ", oProjectProcess.CurrentProjectID, oProjectProcess.Description, oProjectProcess.TranType, oProjectProcess.Category, oProjectProcess.MapSubsidiaryObjectName_1, DataReader.GetNullValue(oProjectProcess.MapSubsidiaryObjectName_2), oProjectProcess.FasSubsidiaryTranObjectName, DataReader.GetNullValue(oProjectProcess.ActivityRelatedSourceObjID), oProjectProcess.IsTranElementRequiredForVoucher, oProjectProcess.ModifiedBy, oProjectProcess.ModifiedDate, oProjectProcess.ID); tc.ExecuteNonQuery(sql); } #endregion #region Delete Function internal static void Delete(TransactionContext tc, int Id) { tc.ExecuteNonQuery("DELETE FROM ProjectProcess WHERE ProcessID=%n", Id); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, int ID, int projecttypeid) { string sql = SQLParser.MakeSQL("SELECT * FROM ProjectProcess WHERE ProcessID=%n AND ProjectID=%n", ID, projecttypeid); return tc.ExecuteReader(sql); } internal static IDataReader GetByTranTypeId(TransactionContext tc, int tranTypeIDinInt, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM ProjectProcess WHERE TranTypeID=%n And ProjectID=%n", tranTypeIDinInt, fundtypeid); } internal static IDataReader Get(TransactionContext tc, string desc, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM ProjectProcess WHERE Description=%s And ProjectID = %n", desc, fundtypeid); } internal static IDataReader GetByDescription(TransactionContext tc, string desc, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM ProjectProcess WHERE Description=%s And ProjectID = %n", desc, fundtypeid); } internal static IDataReader GetbyFundType(TransactionContext tc, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM ProjectProcess Where ProjectID = %n", fundtypeid); } internal static IDataReader GetbyProject(TransactionContext tc, int ID, int category) { return tc.ExecuteReader("SELECT * FROM ProjectProcess WHERE ProjectID=%n AND Category=%n", ID, category); } internal static IDataReader GetByProject(TransactionContext tc, int projectID) { return tc.ExecuteReader("SELECT * FROM ProjectProcess WHERE ProjectID=%n", projectID); } #endregion } }