public bool Update(TotalSalesBLL totalSales)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(GlobalConfig.CnnString(db));

            try
            {
                string     sql = "UPDATE TotalSales SET TotalSales=@TotalSales WHERE Id=@Id";
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@Id", totalSales.Id);
                cmd.Parameters.AddWithValue("@TotalSales", totalSales.TotalSales);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    // Query successful
                    isSuccess = true;
                }
                else
                {
                    // Query failed
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                // Throw message if any error occurs
                MessageBox.Show(ex.Message, "Update data in Database Information!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
        public bool Insert(TotalSalesBLL totalSales)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(GlobalConfig.CnnString(db));

            try
            {
                string     sql = "INSERT INTO TotalSales (TotalSales, DatePurchased) VALUES (@TotalSales, @DatePurchased)";
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@TotalSales", totalSales.TotalSales);
                cmd.Parameters.AddWithValue("@DatePurchased", totalSales.DatePurchased);
                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    // Query successful
                    isSuccess = true;
                }
                else
                {
                    // Query failed
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                // Throw message if any error occurs
                MessageBox.Show(ex.Message, "Insert data in Database Information!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }