public static LandingPage Save(LandingPage landingpage) { DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.ctx_SAVE_LANDINGPAGE"); cmd.AddInputOutputParam("pLandingPageID", DbType.Guid, landingpage.ID); cmd.AddInputOutputParam("pOfferID", DbType.Guid, landingpage.OfferID); cmd.AddInputOutputParam("pDesignerID", DbType.Guid, landingpage.DesignerID); cmd.AddInputOutputParam("pName", DbType.String, landingpage.Name); cmd.AddInputOutputParam("pUrl", DbType.String, landingpage.Url); cmd.AddInputOutputParam("pWeight", DbType.Int32, landingpage.Weight); cmd.AddInputOutputParam("pType", DbType.Int32, landingpage.Type); cmd.AddInputOutputParam("pActive", DbType.Boolean, landingpage.IsActive); cmd.AddInputOutputParam("pApproved", DbType.Boolean, landingpage.IsApproved); cmd.AddOutputParam("oLastEditDate", DbType.DateTime); cmd.AddOutputParam("oCreationDate", DbType.DateTime); SqlHelpers.ExecuteNonQuery(cmd); landingpage.ID = cmd.ExtractGuid("pLandingPageID"); landingpage.OfferID = cmd.ExtractGuid("pOfferID"); landingpage.DesignerID = cmd.ExtractGuid("pDesignerID"); landingpage.Name = cmd.ExtractString("pName"); landingpage.Url = cmd.ExtractString("pUrl"); landingpage.Weight = int.Parse(cmd.ExtractString("pWeight").ToString()); landingpage.Type = int.Parse(cmd.ExtractString("pType").ToString()); landingpage.IsActive = cmd.ExtractBool("pActive"); landingpage.IsApproved = cmd.ExtractBool("pApproved"); landingpage.LastEditDate = cmd.ExtractDateTime("oLastEditDate"); landingpage.CreationDate = cmd.ExtractDateTime("oCreationDate"); return landingpage; }
public static LandingPage ToLandingPage(this DataRow dr) { LandingPage page2 = new LandingPage(); page2.ID = dr.GetGuid("LandingPageID"); page2.OfferID = dr.GetGuid("OfferID"); page2.DesignerID = dr.GetGuid("DesignerID"); page2.Name = dr.GetString("Name"); page2.Url = dr.GetString("Url"); page2.Weight = dr.GetInt("Weight"); page2.Type = dr.GetInt("Type"); page2.IsActive = new bool?(dr.GetBoolean("Active")); page2.IsApproved = new bool?(dr.GetBoolean("Approved")); page2.CreationDate = dr.GetDate("CreationDate"); page2.LastEditDate = dr.GetDate("LastEditDate"); return page2; }