public Int32 UpdateProduct(UnlockingPrice up) { using (MySqlConnection cn = new MySqlConnection(ConneStr)) { String query = "UPDATE UnlockingPrice SET Rogers=@Rogers,Bell=@Bell,Telus=@Telus,Fido=@Fido,Koodo=@Koodo,Virgin=@Virgin,Wind=@Wind,Other=@Other WHERE Model=@Model "; MySqlCommand cmand = new MySqlCommand(query, cn); cmand.Parameters.Add("@Model", MySqlDbType.VarChar).Value = up.modelName; cmand.Parameters.Add("@Rogers", MySqlDbType.VarChar).Value = up.Rogers; cmand.Parameters.Add("@Bell", MySqlDbType.VarChar).Value = up.Bell; cmand.Parameters.Add("@Telus", MySqlDbType.VarChar).Value = up.Telus; cmand.Parameters.Add("@Fido", MySqlDbType.VarChar).Value = up.Fido; cmand.Parameters.Add("@Koodo", MySqlDbType.VarChar).Value = up.Koodo; cmand.Parameters.Add("@Virgin", MySqlDbType.VarChar).Value = up.Virgin; cmand.Parameters.Add("@Wind", MySqlDbType.VarChar).Value = up.Wind; cmand.Parameters.Add("@Other", MySqlDbType.VarChar).Value = up.Other; cn.Open(); return(cmand.ExecuteNonQuery()); } }
public Int32 DeleteProduct(UnlockingPrice up) { using (MySqlConnection cn = new MySqlConnection(ConneStr)) { String query = "Delete from UnlockingPrice where Model=@Model "; MySqlCommand cmand = new MySqlCommand(query, cn); cmand.Parameters.Add("@Model", MySqlDbType.VarChar).Value = up.modelName; cmand.Parameters.Add("@Rogers", MySqlDbType.VarChar).Value = up.Rogers; cmand.Parameters.Add("@Bell", MySqlDbType.VarChar).Value = up.Bell; cmand.Parameters.Add("@Telus", MySqlDbType.VarChar).Value = up.Telus; cmand.Parameters.Add("@Fido", MySqlDbType.VarChar).Value = up.Fido; cmand.Parameters.Add("@Koodo", MySqlDbType.VarChar).Value = up.Koodo; cmand.Parameters.Add("@Virgin", MySqlDbType.VarChar).Value = up.Virgin; cmand.Parameters.Add("@Wind", MySqlDbType.VarChar).Value = up.Wind; cmand.Parameters.Add("@Other", MySqlDbType.VarChar).Value = up.Other; cn.Open(); return(cmand.ExecuteNonQuery()); } }
public Int32 AddProduct(UnlockingPrice up) { using (MySqlConnection cn = new MySqlConnection(ConneStr)) { String query = "INSERT INTO UnlockingPrice(Model,Rogers,Bell,Telus,Fido,Koodo,Virgin,Wind,Other) Values (@Model,@Rogers,@Bell,@Telus,@Fido,@Koodo,@Virgin,@Wind,@Other) "; MySqlCommand cmand = new MySqlCommand(query, cn); cmand.Parameters.Add("@Model", MySqlDbType.VarChar).Value = up.modelName; cmand.Parameters.Add("@Rogers", MySqlDbType.VarChar).Value = up.Rogers; cmand.Parameters.Add("@Bell", MySqlDbType.VarChar).Value = up.Bell; cmand.Parameters.Add("@Telus", MySqlDbType.VarChar).Value = up.Telus; cmand.Parameters.Add("@Fido", MySqlDbType.VarChar).Value = up.Fido; cmand.Parameters.Add("@Koodo", MySqlDbType.VarChar).Value = up.Koodo; cmand.Parameters.Add("@Virgin", MySqlDbType.VarChar).Value = up.Virgin; cmand.Parameters.Add("@Wind", MySqlDbType.VarChar).Value = up.Wind; cmand.Parameters.Add("@Other", MySqlDbType.VarChar).Value = up.Other; cn.Open(); return(cmand.ExecuteNonQuery()); } }