public List<DAO.BazarCostEntry> getAllBazarCost()
        {
            try
               {
               aSqlConnection.Open();
               SqlCommand command = new SqlCommand("uspBazarCost", aSqlConnection);
               command.CommandType = CommandType.StoredProcedure;
               SqlDataReader aReader = command.ExecuteReader();
               abazarCostEntryList = new List<BazarCostEntry>();
               if (aReader.HasRows)
               {
                   while (aReader.Read())
                   {
                      BazarCostEntry aBazarCostEntry=new BazarCostEntry();
                      aBazarCostEntry.id = (int) aReader[0];
                      aBazarCostEntry.amount = Convert.ToInt32(aReader[1].ToString());
                      aBazarCostEntry.date= (DateTime) aReader[2];
                      abazarCostEntryList.Add(aBazarCostEntry);
                   }
               }

               }
               catch (Exception e)
               {
               MessageBox.Show(e.Message);
               }
               finally
               {
               if (aSqlConnection != null && aSqlConnection.State == ConnectionState.Open)
               {
                   aSqlConnection.Close();
               }
               }
               return abazarCostEntryList;
        }
        public string save(BazarCostEntry aBazarCostEntry)
        {
            try
               {
               new BazarCostEntryValidator().isValidCost(aBazarCostEntry.amount);
               if ((aBazarCostEntry.amount == 0))
               {
                   return "please fill all the field";
               }
               else
               {
                   return aBazarCostEntryGateway.save(aBazarCostEntry);
               }
               }
               catch (Exception e)
               {

               throw new Exception(e.Message,e);
               }
        }
 private void saveButton_Click(object sender, EventArgs e)
 {
     try
     {
         BazarCostEntry aBazarCostEntry = new BazarCostEntry(Convert.ToInt32(amountTextBox.Text),
             dateTimePicker1.Value);
         string msg = aBazarCostEntryBll.save(aBazarCostEntry);
         MessageBox.Show(msg, @"Message");
         showDataInDataGrid();
         clearTextBoxes();
     }
     catch (FormatException ex)
     {
         MessageBox.Show(@"Enter amount in correct format.",ex.Message);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }