public static ContactpersonType VerwerkRij(IDataRecord rij) { ContactpersonType type = new ContactpersonType(); type.ID = Convert.ToInt32(rij["ID"].ToString()); type.Name = rij["Name"].ToString(); return type; }
public static ContactpersonType GetContactPersonTypeByID(int i) { ContactpersonType nieuw = new ContactpersonType(); string sql = "SELECT * FROM ContactPersonType WHERE ID like @ID"; DbParameter paramID = Database.AddParameter("@ID", i); DbDataReader reader = Database.GetData(sql,paramID); while (reader.Read()) { nieuw = VerwerkRijSpecial(reader); } return nieuw; }
public static void DeleteType(ContactpersonType SelectedContactPerson) { try { DbParameter paramName = Database.AddParameter("@Name", SelectedContactPerson.Name); Database.ModifyData("DELETE FROM ContactPersonType WHERE Name = @Name", paramName); } catch (Exception e) { throw e; } }
public static void AddType(ContactpersonType SelectedContactPerson) { try { DbParameter paramName = Database.AddParameter("@Name", SelectedContactPerson.Name); Database.ModifyData("INSERT INTO ContactPersonType (Name) values (@Name)", paramName); } catch (Exception e) { Console.WriteLine(e.Message); } }