public bool AddItem(string Abrev) { if (ColorExist(Abrev)) { return false; } else { Colors s = new Colors(Abrev); sList.Add(s); return true; } }
public static Colors PopulateColorsFromSqlDataReader(SqlDataReader dr) { Colors colors = new Colors(); colors.Id = Convert.ToInt32(dr["Id"]); colors.ColorName = Convert.ToString(dr["ColorName"]); colors.ColorNumber = Convert.ToString(dr["ColorNumber"]); colors.ColorManufacturer = Convert.ToString(dr["ColorManufacturer"]); colors.Abrev = Convert.ToString(dr["Abrev"]); colors.PoundsInStock = Convert.ToString(dr["PoundsInStock"]); colors.DesiredPounds = Convert.ToString(dr["DesiredPounds"]); return colors; }
private void Form1_Load(object sender, EventArgs e) { PartsL = new PartsList(); PartNoCombo.DataSource = PartsL.ListParts(); FeetCB.DataSource = cFeet; MinConvCB.DataSource = cConvSpeed; PartsSelectedCustList.Items.Clear(); PartsUnSelectedCustList.Items.Clear(); ColorsL = new ColorsList(); PartColorCombo.DataSource = ColorsL.ListColors(); Colors c = new Colors(); c = ColorsL.SearchColor(PartColorCombo.SelectedItem.ToString()); powderlbl.Text = c.ColorNumber; }
public void AddColors(Colors Color) { // Initialize SPROC SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand("SPColorInsert", conn); cmd.CommandType = CommandType.StoredProcedure; // Add Parameters cmd.Parameters.AddWithValue("@ColorName", Color.ColorName); cmd.Parameters.AddWithValue("@ColorNumber", Color.ColorNumber); cmd.Parameters.AddWithValue("@ColorManufacturer", Color.ColorManufacturer); cmd.Parameters.AddWithValue("@Abrev", Color.Abrev); cmd.Parameters.AddWithValue("@PoundsInStock", Color.PoundsInStock); cmd.Parameters.AddWithValue("@DesiredPounds", Color.DesiredPounds); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); reload(); }
public Colors SearchColor(string Abrev) { foreach (Colors Color in sList) { if (Color.Abrev == Abrev) { return (Color); } } Colors s = new Colors(Abrev); return (s); }
private void PartColorCombo_SelectedIndexChanged(object sender, EventArgs e) { Colors c = new Colors(); c = ColorsL.SearchColor(PartColorCombo.SelectedItem.ToString()); powderlbl.Text = c.ColorNumber; }