public static void FillObject(Business.DataObjectProduct item, SqlDataReader sqlReader) { if (sqlReader["ProductRef"] != DBNull.Value) { item.ProductRef = sqlReader["ProductRef"].ToString(); } if (sqlReader["ProductText"] != DBNull.Value) { item.ProductText = sqlReader["ProductText"].ToString(); } if (sqlReader["ProductTextLinked"] != DBNull.Value) { item.ProductTextLinked = sqlReader["ProductTextLinked"].ToString(); } if (sqlReader["Price1"] != DBNull.Value) { item.Price1 = Convert.ToDouble(sqlReader["Price1"]); } if (sqlReader["Price2"] != DBNull.Value) { item.Price2 = Convert.ToDouble(sqlReader["Price2"]); } if (sqlReader["Price3"] != DBNull.Value) { item.Price3 = Convert.ToDouble(sqlReader["Price3"]); } if (sqlReader["Porto"] != DBNull.Value) { item.Porto = Convert.ToDouble(sqlReader["Porto"]); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Settings != null) { if (Settings.ContainsKey("Width")) { WidthImg = string.Format("{0}px", 325); WidthCnt = string.Format("{0}px", (int)Settings["Width"] - 325); } } if (DataObject is Business.DataObjectProduct) { dataObjectProduct = (Business.DataObjectProduct)DataObject; } else { dataObjectProduct = DataAccess.Business.DataObject.Load <Business.DataObjectProduct>(DataObject.ObjectID, null, false); } PrintOutput(); // Set widget title Control widgetControl = WidgetHelper.GetWidgetHost(this, 0, 5); ((Literal)widgetControl.FindControl("LitTitle")).Text = string.Format("<h1>{0}</h1>", dataObjectProduct.Title); if ((PageType)Settings["ParentPageType"] == PageType.Detail) { ((IWidgetPageMaster)Page.Master).BreadCrumb.RenderDetailPageBreadCrumbs(dataObjectProduct); } } catch { } }
protected void Page_Load(object sender, EventArgs e) { product = _4screen.CSB.DataAccess.Business.DataObject.Load <Business.DataObjectProduct>(ObjectID, null, true); if (product.State == ObjectState.Added) { product.ObjectID = ObjectID; product.Title = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed"); product.CommunityID = CommunityID; product.ShowState = ObjectShowState.Draft; product.Insert(UserDataContext.GetUserDataContext()); } if (!string.IsNullOrEmpty(Request.QueryString["TG"])) { product.TagList = Server.UrlDecode(Request.QueryString["TG"]); } if (!string.IsNullOrEmpty(Request.QueryString["OS"])) { product.Status = (ObjectStatus)int.Parse(Request.QueryString["OS"]); } if (!string.IsNullOrEmpty(Request.QueryString["SS"])) { product.ShowState = (ObjectShowState)int.Parse(Request.QueryString["SS"]); } if (!string.IsNullOrEmpty(Request.QueryString["CR"])) { product.Copyright = int.Parse(Request.QueryString["CR"]); } if (!string.IsNullOrEmpty(Request.QueryString["GC"])) { string[] geoLatLong = Request.QueryString["GC"].Split(','); double geoLat, geoLong = double.MinValue; if (geoLatLong.Length == 2) { if (double.TryParse(geoLatLong[0], out geoLat) && double.TryParse(geoLatLong[1], out geoLong)) { product.Geo_Lat = geoLat; product.Geo_Long = geoLong; } } } if (!string.IsNullOrEmpty(Request.QueryString["ZP"])) { product.Zip = Server.UrlDecode(Request.QueryString["ZP"]); } if (!string.IsNullOrEmpty(Request.QueryString["CI"])) { product.City = Server.UrlDecode(Request.QueryString["CI"]); } if (!string.IsNullOrEmpty(Request.QueryString["RE"])) { product.Region = Server.UrlDecode(Request.QueryString["RE"]); } if (!string.IsNullOrEmpty(Request.QueryString["CO"])) { product.CountryCode = Server.UrlDecode(Request.QueryString["CO"]); } FillEditForm(); }
private static void SetParameters(Business.DataObjectProduct item, SqlParameterCollection parameters) { if (!string.IsNullOrEmpty(item.ProductRef)) { parameters.AddWithValue("@ProductRef", item.ProductRef); } else { parameters.AddWithValue("@ProductRef", DBNull.Value); } if (!string.IsNullOrEmpty(item.ProductText)) { parameters.AddWithValue("@ProductText", item.ProductText); } else { parameters.AddWithValue("@ProductText", DBNull.Value); } if (!string.IsNullOrEmpty(item.productTextLinked)) { parameters.AddWithValue("@ProductTextLinked", item.productTextLinked); } else { parameters.AddWithValue("@ProductTextLinked", DBNull.Value); } if (item.Price1.HasValue) { parameters.AddWithValue("@Price1", item.Price1.Value); } else { parameters.AddWithValue("@Price1", DBNull.Value); } if (item.Price2.HasValue) { parameters.AddWithValue("@Price2", item.Price2.Value); } else { parameters.AddWithValue("@Price2", DBNull.Value); } if (item.Price3.HasValue) { parameters.AddWithValue("@Price3", item.Price3.Value); } else { parameters.AddWithValue("@Price3", DBNull.Value); } if (item.Porto.HasValue) { parameters.AddWithValue("@Porto", item.Porto.Value); } else { parameters.AddWithValue("@Porto", DBNull.Value); } }
public static string GetUpdateSQL(Business.DataObjectProduct item, SqlParameterCollection parameters) { SetParameters(item, parameters); return("UPDATE hiobj_Product SET [ProductRef] = @ProductRef, [ProductText] = @ProductText, [ProductTextLinked] = @ProductTextLinked, [Price1] = @Price1, [Price2] = @Price2, [Price3] = @Price3, [Porto] = @Porto"); }
public static string GetInsertSQL(Business.DataObjectProduct item, SqlParameterCollection parameters) { SetParameters(item, parameters); return("INSERT INTO hiobj_Product ([OBJ_ID],[ProductRef],[ProductText],[ProductTextLinked],[Price1],[Price2],[Price3],[Porto]) VALUES (@OBJ_ID,@ProductRef,@ProductText,@ProductTextLinked,@Price1,@Price2,@Price3,@Porto)"); }