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

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