using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class ErCVTrainingDA { internal static void Insert(ErCVTraining exprItem, TransactionContext tc) { DateTime? ToDate; //if (exprItem.ToDate == DateTime.MinValue) //{ // ToDate = null; //} //else ToDate = exprItem.ToDate; string sql = SQLParser.MakeSQL( @"INSERT INTO ERCVTRAINING ( ERCVTRAININGID, Name, Description, Country, INSTITUTIONID, TRAININGPLACE, FROMDATE, TODATE, TRAININGTYPEID, NATUREOFTRAININGID, CVID,DAYS,HOURS,InstituteName ) VALUES ( %n, %s, %s, %n, %n, %s, %d, %d, %n, %n, %n,%s,%s,%s )", exprItem.ID, exprItem.Name, exprItem.Description, exprItem.CountryID, exprItem.InstitutionID, exprItem.Place, exprItem.FromDate, exprItem.ToDate, exprItem.TrainingTypeID, exprItem.NatureOfTrainingID, exprItem.CVID, exprItem.Days, exprItem.Hours, exprItem.InstituteName); tc.ExecuteNonQuery(sql); } internal static void Update(ErCVTraining exprItem, TransactionContext tc) { //DateTime? ToDate; //if (exprItem.ToDate == DateTime.MinValue) //{ // ToDate = null; //} //else ToDate = exprItem.ToDate; string sql = SQLParser.MakeSQL( @"UPDATE ERCVTRAINING SET Name = %s, Description = %s, Country = %n, INSTITUTIONID = %n, TRAININGPLACE = %s, FROMDATE = %d, TODATE = %d, TRAININGTYPEID = %n, NATUREOFTRAININGID = %n, CVID = %n, DAYS=%s, HOURS=%s, InstituteName=%s WHERE ERCVTRAININGID = %n", exprItem.Name, exprItem.Description, exprItem.CountryID, exprItem.InstitutionID, exprItem.Place, exprItem.FromDate, exprItem.ToDate, exprItem.TrainingTypeID, exprItem.NatureOfTrainingID, exprItem.CVID, exprItem.Days, exprItem.Hours, exprItem.InstituteName, exprItem.ID); tc.ExecuteNonQuery(sql); } internal static void Delete(int iD, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From ERCVTRAINING Where CVID = %n", iD); tc.ExecuteNonQuery(sql); } internal static void DeleteByCvId(int oID, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From ERCVTRAINING Where CVID = %n", oID); tc.ExecuteNonQuery(sql); } } }