public CustomerFacility(Guid customerfacilityid, Address address, Territory territory, Customer customer) { this.customerfacilityid= customerfacilityid; this.address= address; this.territory= territory; this.customer= customer; }
public static void UpdateAddress(Address address) { string sqlQuery = "UPDATE Address SET CountryID=@CountryID, CityID=@CityID, Street=@Street, ZipCode=@ZipCode, HouseNr=@HouseNr, ApartmentNr=@AparmentNr WHERE AddressID=@AddressID"; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "AddressID", DbType.Guid, address.AddressID); DBHelper.AddInParameter(dbCommand, "CountryID", DbType.Guid, address.CountryID); DBHelper.AddInParameter(dbCommand, "CityID", DbType.Guid, address.CityID); DBHelper.AddInParameter(dbCommand, "Street", DbType.String, address.Street); DBHelper.AddInParameter(dbCommand, "ZipCode", DbType.String, address.ZipCode); DBHelper.AddInParameter(dbCommand, "HouseNr", DbType.String, address.HouseNr); DBHelper.AddInParameter(dbCommand, "ApartmentNr", DbType.String, address.ApartmentNr); DBHelper.ExecuteNonQuery(dbCommand); }
public static Address InsertAddress(Address address) { string sqlQuery = "INSERT INTO Address(AddressID,CountryID,CityID,Street,ZipCode,HouseNr,ApartmentNr) " + " VALUES(@AddressID,@CountryID,@CityID,@Street,@ZipCode,@HouseNr,@ApartmentNr)"; if (address.AddressID == Guid.Empty) address.AddressID = Guid.NewGuid(); else return null; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "AddressID", DbType.Guid, address.AddressID); DBHelper.AddInParameter(dbCommand, "CountryID", DbType.Guid, address.CountryID); DBHelper.AddInParameter(dbCommand, "CityID", DbType.Guid, address.CityID); DBHelper.AddInParameter(dbCommand, "Street", DbType.String, address.Street); DBHelper.AddInParameter(dbCommand, "ZipCode", DbType.String, address.ZipCode); DBHelper.AddInParameter(dbCommand, "HouseNr", DbType.String, address.HouseNr); DBHelper.AddInParameter(dbCommand, "ApartmentNr", DbType.String, address.ApartmentNr); return address; }
private static Address GetAddressFromReader(IDataReader dataReader) { Address address = new Address(); address.AddressID = DBHelper.GetGuid(dataReader, "AddressID"); address.ZipCode = DBHelper.GetString(dataReader, "ZipCode"); address.Street = DBHelper.GetString(dataReader, "Street"); address.HouseNr = DBHelper.GetString(dataReader, "HouseNr"); address.ApartmentNr = DBHelper.GetString(dataReader, "ApartmentNr"); //address.City = DBHelper.GetString(dataReader, "City"); address.CityID = DBHelper.GetGuid(dataReader, "CityID"); address.CountryID = DBHelper.GetGuid(dataReader, "CountryID"); return address; }
public static void UpdateAddress(Address address) { AddressDB.UpdateAddress(address); }
public static Address InsertAddress(Address address) { return AddressDB.InsertAddress(address); }