public static System.Collections.Generic.List <KursusDag> GetAllKursusDagList(int KursusPolicyID) { System.Collections.Generic.List <KursusDag> result = new System.Collections.Generic.List <KursusDag>(); int ID = -1; DBAccess db = new DBAccess(); db.AddInt("KursusPolicyID", KursusPolicyID); SqlDataReader dr = default(SqlDataReader); try { dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAllList)); if (dr.HasRows) { while (dr.Read()) { KursusDag kd = new KursusDag(); Populate(dr, kd); result.Add(kd); } } dr.Close(); } catch (Exception ex) { throw (ex); } return(result); }
public static int Insert(KursusDag c) { DBAccess db = new DBAccess(); if (c.Status == KursusStatusEnum.Initialize) { c.Status = KursusStatusEnum.Aktiv; } AddParms(ref db, c); SqlParameter objParam = new SqlParameter("@ID", 0); objParam.Direction = ParameterDirection.Output; db.Parameters.Add(objParam); int retval = db.ExecuteNonQuery(_SQLInsert); if (retval == 1) { return(int.Parse(objParam.Value.ToString())); } else { return(-1); } }
private static void Populate(System.Data.SqlClient.SqlDataReader dr, KursusDag c) { var with_1 = c; with_1.KursusPolicyID = System.Convert.ToInt32(dr.DBtoInt("KursusPolicyID")); with_1.KursusDato = System.Convert.ToDateTime(dr.DBtoDate("KursusDato")); with_1.Repetionskursus = System.Convert.ToBoolean(dr.DBtoBool("Repetionskursus")); with_1.Status = (RescueTekniq.BOL.KursusStatusEnum)(dr.DBtoInt("Status")); PopulateStandard(dr, c); }
private static void AddParms(ref DBAccess db, KursusDag c) { var with_1 = c; db.AddInt("KursusPolicyID", with_1.KursusPolicyID); db.AddDateTime("KursusDato", with_1.KursusDato); db.AddBoolean("Repetionskursus", with_1.Repetionskursus); db.AddInt("Status", (System.Int32)with_1.Status); AddParmsStandard(db, c); }
public static int Update(int ID, int KursusPolicyID, DateTime KursusDato, bool Repetionskursus, KursusStatusEnum Status) { KursusDag c = new KursusDag(ID); c.KursusPolicyID = KursusPolicyID; c.KursusDato = KursusDato; c.Repetionskursus = Repetionskursus; c.Status = Status; return(Update(c)); }
public static int Update(KursusDag c) { DBAccess db = new DBAccess(); db.AddInt("ID", c.ID); AddParms(ref db, c); int retval = db.ExecuteNonQuery(_SQLUpdate); return(retval); }
public static KursusDag GetKursusDag(int ID) { DBAccess db = new DBAccess(); db.AddInt("ID", ID); KursusDag c = new KursusDag(); SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectOne)); if (dr.HasRows) { while (dr.Read()) { Populate(dr, c); } dr.Close(); } return(c); }
public static KursusDag GetKursusDag(int KursusPolicyID, DateTime KursusDato) { KursusDag c = new KursusDag(); DBAccess db = new DBAccess(); db.AddDateTime("KursusDato", KursusDato); db.AddInt("KursusPolicyID", KursusPolicyID); SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByDate)); if (dr.HasRows) { while (dr.Read()) { Populate(dr, c); } dr.Close(); } return(c); }
public static int Delete(KursusDag c) { return(Delete(c.ID)); }