public static bool Update(CustomerClassPrice customerClassPrice)
 {
     try
     {
         using (var conn = new MySqlConnection(Globals.CONN_STR))
         {
             conn.Open();
             var sql = @"UPDATE customer_class_price 
                         set end_date =@end_date,
                         unit_price=@unit_price, 
                         modified_at=CURRENT_TIMESTAMP,
                         modified_by=@modified_by 
                         WHERE product_code = @product_code
                         And class_id = @class_id
                         And start_date = @start_date";
             var cmd = new MySqlCommand(sql, conn);
             cmd.Parameters.AddWithValue("class_id", customerClassPrice.MasterClass.ClassId);
             cmd.Parameters.AddWithValue("product_code", customerClassPrice.Product.ProductCode);
             cmd.Parameters.AddWithValue("start_date", customerClassPrice.StartDate);
             cmd.Parameters.AddWithValue("end_date", customerClassPrice.EndDate);
             cmd.Parameters.AddWithValue("unit_price", customerClassPrice.UnitPrice);
             cmd.Parameters.AddWithValue("modified_by", customerClassPrice.ModifiedBy);
             var affRow = cmd.ExecuteNonQuery();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public static bool Insert(CustomerClassPrice customerClassPrice)
        {
            try
            {
                using (var conn = new MySqlConnection(Globals.CONN_STR))
                {
                    conn.Open();
                    var sql = @"INSERT INTO customer_class_price
                                    (class_id, product_code, start_date, end_date, 
                                    unit_price, create_by) 
                                    VALUES 
                                     (@class_id, @product_code, @start_date, @end_date, 
                                    @unit_price, @create_by) ";

                    var cmd = new MySqlCommand(sql, conn);
                    cmd.Parameters.AddWithValue("class_id", customerClassPrice.MasterClass.ClassId);
                    cmd.Parameters.AddWithValue("product_code", customerClassPrice.Product.ProductCode);
                    cmd.Parameters.AddWithValue("start_date", customerClassPrice.StartDate);
                    cmd.Parameters.AddWithValue("end_date", customerClassPrice.EndDate);
                    cmd.Parameters.AddWithValue("unit_price", customerClassPrice.UnitPrice);
                    cmd.Parameters.AddWithValue("create_by", customerClassPrice.CreateBy);
                    var affRow = cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }