public cBroadheads FindBroadhead(string BroadheadID) { cBroadheads tmpTip = new cBroadheads(); cDataController db = new cDataController(); db.OpenDatabase(Directory.GetCurrentDirectory().ToString() + "./data/AW.db"); DataTable dtTmp = db.ExecuteQuery("select * from broadheads where broadheadID = " + BroadheadID); foreach (DataRow row in dtTmp.Rows) { tmpTip = new cBroadheads(row["BroadheadID"].ToString(), row["Manufacturer"].ToString(), row["TipName"].ToString(), row["Type"].ToString(), row["BladeCount"].ToString(), row["Grains"].ToString(), row["CuttingDiameter"].ToString()); } return(tmpTip); }
public List <cBroadheads> GetBroadheads(string query) { List <cBroadheads> lReturnValue = new List <cBroadheads>(); cDataController db = new cDataController(); db.OpenDatabase(Directory.GetCurrentDirectory().ToString() + "./data/AW.db"); DataTable dtTmp = db.ExecuteQuery("select * from broadheads " + query + " order by Manufacturer"); foreach (DataRow row in dtTmp.Rows) { cBroadheads tmpTip = new cBroadheads(row["BroadheadID"].ToString(), row["Manufacturer"].ToString(), row["TipName"].ToString(), row["Type"].ToString(), row["BladeCount"].ToString(), row["Grains"].ToString(), row["CuttingDiameter"].ToString()); lReturnValue.Add(tmpTip); } return(lReturnValue); }
private void listBroadheads_SelectedIndexChanged(object sender, EventArgs e) { string tmpStr = ""; bool bTemp = false; for (int i = 0; i < listBroadheads.Text.Length; i++) { if (listBroadheads.Text[i].ToString() == ":") { bTemp = true; } if (!bTemp) { tmpStr += listBroadheads.Text[i]; } } cBroadheadTools tmpTools = new cBroadheadTools(); cBroadheads tmpTip = tmpTools.FindBroadhead(tmpStr); lblManufacturer.Text = tmpTip.Manufacturer; lblBladeCount.Text = tmpTip.BladeCount.ToString(); lblCuttingDiameter.Text = tmpTip.CuttingDiameter.ToString() + "\""; lblGrains.Text = tmpTip.Grains.ToString() + "gr"; lblName.Text = tmpTip.TipName; if (tmpTip.Type == "f") { lblType.Text = "Fixed Blade"; } else if (tmpTip.Type == "m") { lblType.Text = "Mechanical Blade"; } else { lblType.Text = "Small Game"; } }