private static void Populate(SqlDataReader dr, NewsGrp c) { var with_1 = c; with_1.ParentID = System.Convert.ToInt32(dr.DBtoInt("ParentID")); with_1.NewsGrpNr = dr.DBtoString("NewsGrpNr"); with_1.NewsGrpTekst = dr.DBtoString("NewsGrpTekst"); PopulateStandard(dr, c); }
private static void AddParms(ref DBAccess db, NewsGrp c) { var with_1 = c; db.AddInt("ParentID", with_1.ParentID); db.AddNVarChar("NewsGrpNr", with_1.NewsGrpNr, 50); db.AddNVarChar("NewsGrpTekst", with_1.NewsGrpTekst, 50); AddParmsStandard(db, c); }
public static int Update(int ID, int ParentID, string NewsGrpNr, string NewsGrpTekst) { NewsGrp c = new NewsGrp(ID); c.ParentID = ParentID; c.NewsGrpNr = NewsGrpNr; c.NewsGrpTekst = NewsGrpTekst; return Update(c); }
public static int Update(NewsGrp c) { DBAccess db = new DBAccess(); db.AddInt("ID", c.ID); AddParms(ref db, c); int retval = db.ExecuteNonQuery(_SQLUpdate); return retval; }
public static int Insert(int ParentID, string NewsGrpNr, string NewsGrpTekst) { NewsGrp c = new NewsGrp(); c.ParentID = ParentID; c.NewsGrpNr = NewsGrpNr; c.NewsGrpTekst = NewsGrpTekst; return Insert(c); }
public static int Insert(NewsGrp c) { DBAccess db = new DBAccess(); 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; } }
public static NewsGrp GetNewsGrp(int ID) { DBAccess db = new DBAccess(); db.AddInt("ID", ID); SqlDataReader dr = (SqlDataReader) (db.ExecuteReader(_SQLSelectOne)); if (dr.HasRows) { NewsGrp c = new NewsGrp(); while (dr.Read()) { Populate(dr, c); } dr.Close(); return c; } else { dr.Close(); return null; } }
public static int Delete(NewsGrp c) { return Delete(c.ID); }