public bool AddItem(string ShipName) { if (ShipperExist(ShipName)) { return false; } else { Shippers s = new Shippers(ShipName); sList.Add(s); return true; } }
public static Shippers PopulateShippersFromSqlDataReader(SqlDataReader dr) { Shippers shippers = new Shippers(); shippers.ID = Convert.ToInt32(dr["ID"]); shippers.Shipper = Convert.ToString(dr["Shipper"]); shippers.Phone = Convert.ToString(dr["Phone"]); shippers.Fax = Convert.ToString(dr["Fax"]); shippers.Comments = Convert.ToString(dr["Comments"]); shippers.Cell = Convert.ToString(dr["Cell"]); shippers.Other = Convert.ToString(dr["Other"]); return shippers; }
public void AddShippers(Shippers Shippers) { // Initialize SPROC SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand("SPShippersInsert", conn); cmd.CommandType = CommandType.StoredProcedure; // Add Parameters cmd.Parameters.AddWithValue("@ID", 0); cmd.Parameters.AddWithValue("@Shipper", Shippers.Shipper); cmd.Parameters.AddWithValue("@Phone", Shippers.Phone); cmd.Parameters.AddWithValue("@Fax", Shippers.Fax); cmd.Parameters.AddWithValue("@Comments", Shippers.Comments); cmd.Parameters.AddWithValue("@Cell", Shippers.Cell); cmd.Parameters.AddWithValue("@Other", Shippers.Other); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); reload(); }
private void Object2Form(Shippers s) { int Index = comboBox1.FindString(s.Shipper); comboBox1.SelectedIndex = Index; textBox1.Text = s.Comments; textBox2.Text = s.Phone; textBox3.Text = s.Fax; textBox4.Text = s.Cell; textBox5.Text = s.Other; }
private Shippers Form2Object() { Shippers tship = new Shippers(0, comboBox1.Text, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text); return tship; }
public Shippers SearchShipper(string ShipperName) { foreach (Shippers Ship in sList) { if (Ship.Shipper == ShipperName) { return Ship; } } Shippers s = new Shippers(ShipperName); return (s); }