public static Importer Create(Guid notiificationId, Guid id, Business business = null, Address address = null, string name = "AnyName") { if (business == null) { business = ComplexTypeFactory.Create<Business>(); ObjectInstantiator<Business>.SetProperty(x => x.Name, name, business); } if (address == null) { address = ComplexTypeFactory.Create<Address>(); } var importer = new Importer(notiificationId, address, business, ComplexTypeFactory.Create<Contact>()); EntityHelper.SetEntityId(importer, id); return importer; }
public static Producer Create(Guid id, Business business = null, Address address = null, string name = "AnyName") { var producer = ObjectInstantiator<Producer>.CreateNew(); EntityHelper.SetEntityId(producer, id); if (business == null) { business = ComplexTypeFactory.Create<Business>(); ObjectInstantiator<Business>.SetProperty(x => x.Name, name, business); } if (address == null) { address = ComplexTypeFactory.Create<Address>(); } ObjectInstantiator<Producer>.SetProperty(x => x.Business, business, producer); ObjectInstantiator<Producer>.SetProperty(x => x.Address, address, producer); return producer; }
public static void Update(Business Business) { DbCommand cmd = db.GetStoredProcCommand("dbo.UpdateBusiness"); db.AddInParameter(cmd, "@Name", DbType.String, Business.Name); db.AddInParameter(cmd, "@Email", DbType.String, Business.Email); db.AddInParameter(cmd, "@Password", DbType.String, Business.Password); db.AddInParameter(cmd, "@BusinessId", DbType.Int32, Business.Id); db.ExecuteNonQuery(cmd); }
public static void Insert(Business Business) { DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO Businesses (Email, Password, Name) VALUES ('{0}', '{1}', '{2}');", Business.Email, Business.Password, Business.Name)); db.ExecuteNonQuery(cmd); }
public static void Delete(Business Business) { DbCommand cmd = db.GetStoredProcCommand("dbo.DeleteBusiness"); db.AddInParameter(cmd, "@BusinessId", DbType.Int32, Business.Id); }