public bool Insert(AngilanBLL a)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(UserDAL.myconnstrng);

            try
            {
                string     sql = "INSERT INTO tbl_Angilan (CustomerID, Name, Meter_No, Current_, Previous, Consume, LessCBM, TotalCBM, AmountPerCBM, Bill, PreviousBalance, AmountPaid, DatePaid, OR_No, Balance, Status, Added_Date, OtherInformation) VALUES (@CustomerID, @Name, @Meter_No, @Current, @Previous, @Consume, @LessCBM, @TotalCBM, @AmountPerCBM, @Bill, @PreviousBalance, @AmountPaid, @DatePaid, @OR_No, @Balance, @Status, @Added_Date, @OtherInformation)";
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@CustomerID", a.CustomerID);
                cmd.Parameters.AddWithValue("@Name", a.Name);
                cmd.Parameters.AddWithValue("@Meter_No", a.Meter_No);
                cmd.Parameters.AddWithValue("@Current", a.Current_);
                cmd.Parameters.AddWithValue("@Previous", a.Previous);
                cmd.Parameters.AddWithValue("@Consume", a.Consume);
                cmd.Parameters.AddWithValue("@LessCBM", a.LessCBM);
                cmd.Parameters.AddWithValue("@TotalCBM", a.TotalCBM);
                cmd.Parameters.AddWithValue("@AmountPerCBM", a.AmountPerCBM);
                cmd.Parameters.AddWithValue("@Bill", a.Bill);
                cmd.Parameters.AddWithValue("@PreviousBalance", a.PreviousBalance);
                cmd.Parameters.AddWithValue("@AmountPaid", a.AmountPaid);
                cmd.Parameters.AddWithValue("@DatePaid", a.DatePaid);
                cmd.Parameters.AddWithValue("@OR_No", a.OR_No);
                cmd.Parameters.AddWithValue("@Balance", a.Balance);
                cmd.Parameters.AddWithValue("@Status", a.Status);
                cmd.Parameters.AddWithValue("@Added_Date", a.Added_Date);
                cmd.Parameters.AddWithValue("@OtherInformation", a.OtherInformation);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                // If the query is executed successfully then the value to rows will be greaten than 0 else it will be less than 0
                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);
        }
        public bool Update(AngilanBLL a)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(UserDAL.myconnstrng);

            try
            {
                string     sql = "UPDATE tbl_Angilan SET CustomerID=@CustomerID, Name=@Name, Meter_No=@Meter_No, Current_=@Current, Previous=@Previous, Consume=@Consume, LessCBM=@LessCBM, TotalCBM=@TotalCBM, AmountPerCBM=@AmountPerCBM, Bill=@Bill, PreviousBalance=@PreviousBalance, AmountPaid=@AmountPaid, DatePaid=@DatePaid, OR_No=@OR_No, Balance=@Balance, Status=@Status, OtherInformation=@OtherInformation WHERE ID=@ID"; // Added_Date=@Added_Date,
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@CustomerID", a.CustomerID);
                cmd.Parameters.AddWithValue("@Name", a.Name);
                cmd.Parameters.AddWithValue("@Meter_No", a.Meter_No);
                cmd.Parameters.AddWithValue("@Current", a.Current_);
                cmd.Parameters.AddWithValue("@Previous", a.Previous);
                cmd.Parameters.AddWithValue("@Consume", a.Consume);
                cmd.Parameters.AddWithValue("@LessCBM", a.LessCBM);
                cmd.Parameters.AddWithValue("@TotalCBM", a.TotalCBM);
                cmd.Parameters.AddWithValue("@AmountPerCBM", a.AmountPerCBM);
                cmd.Parameters.AddWithValue("@Bill", a.Bill);
                cmd.Parameters.AddWithValue("@PreviousBalance", a.PreviousBalance);
                cmd.Parameters.AddWithValue("@AmountPaid", a.AmountPaid);
                cmd.Parameters.AddWithValue("@DatePaid", a.DatePaid);
                cmd.Parameters.AddWithValue("@OR_No", a.OR_No);
                cmd.Parameters.AddWithValue("@Balance", a.Balance);
                cmd.Parameters.AddWithValue("@Status", a.Status);
                //cmd.Parameters.AddWithValue("@Added_Date", a.Added_Date);
                cmd.Parameters.AddWithValue("@OtherInformation", a.OtherInformation);
                cmd.Parameters.AddWithValue("@ID", a.ID);

                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 Delete(AngilanBLL a)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(UserDAL.myconnstrng);

            try
            {
                string     sql = "DELETE FROM tbl_Angilan WHERE ID=@ID";
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@ID", a.ID);

                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, "Delete data from Database Information!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }