namespace Holo.Catalogue.Marketplace { using Holo; using Ion.Storage; using System; using System.Collections.Generic; using System.Data; public class Marketplace { public string CCTName; public int Chance; public int Cost_Credits; public int Cost_Pixels; public DateTime ExpiresDate; public double Height; public int ID; public int Length; public string Name; public int OwnerID; public string Poster; public int PosX; public int PosY; public int PosZ; public int Recycleable; public int RoomID; public int Rotation; public int SpriteID; public string StartsWith; public int TemplateID; public byte Tradeable; public string Type; public int TypeID; public int Width; public Holo.Catalogue.Marketplace.Marketplace getItem(DataRow dRow) { return Parse(dRow); } public Holo.Catalogue.Marketplace.Marketplace getItem(int templateID) { using (DatabaseClient client = Eucalypt.dbManager.GetClient()) { new List(); client.AddParamWithValue("@templateid", templateID); DataRow dRow = client.getDataSet("SELECT * FROM marketplace WHERE itemtid = @templateid;").Tables[0].Rows[0]; return Parse(dRow); } } public Holo.Catalogue.Marketplace.Marketplace getitemID(DataRow dRow) { return Parse(dRow); } public Holo.Catalogue.Marketplace.Marketplace getitemID(int itemID) { using (DatabaseClient client = Eucalypt.dbManager.GetClient()) { new List(); client.AddParamWithValue("@itemid", itemID); DataRow dRow = client.getDataSet("SELECT * FROM marketplace WHERE itemtid = @itemid;").Tables[0].Rows[0]; return Parse(dRow); } } public DataRow getItemID(int itemID) { using (DatabaseClient client = Eucalypt.dbManager.GetClient()) { client.AddParamWithValue("@itemid", itemID); client.AddParamWithValue("@templateid", this.TemplateID); return client.getDataSet("SELECT itemid FROM marketplace WHERE itemtid = @templateid;").Tables[0].Rows[0]; } } public DataRow getRowForTemplateID(int templateID) { using (DatabaseClient client = Eucalypt.dbManager.GetClient()) { client.AddParamWithValue("@templateid", templateID); return client.getDataSet("SELECT * FROM catalogue_items WHERE tid = @templateid;").Tables[0].Rows[0]; } } public static Holo.Catalogue.Marketplace.Marketplace Parse(DataRow dRow) { try { Holo.Catalogue.Marketplace.Marketplace marketplace = new Holo.Catalogue.Marketplace.Marketplace(); marketplace.TemplateID = (int) dRow["tid"]; marketplace.CCTName = (string) dRow["name_cct"]; marketplace.Cost_Credits = (int) dRow["catalogue_cost_credits"]; marketplace.Cost_Pixels = (int) dRow["catalogue_cost_pixels"]; marketplace.TypeID = (int) dRow["typeid"]; marketplace.Length = (int) dRow["length"]; marketplace.Width = (int) dRow["width"]; marketplace.Height = (double) dRow["top"]; return marketplace; } catch { } return null; } } }