public bool Insert(pmmaDateBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_pmma_date 
                            (" + dateMonth + "," + dateYear + "," + dateStart + "," + dateEnd + "," + dateUpdatedDate + "," + dateUpdatedBy + ") VALUES (@month,@year," +
                             "@date_start," +
                             "@date_end," +
                             "@updated_date," +
                             "@updated_by)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@month", u.month);
                cmd.Parameters.AddWithValue("@year", u.year);
                cmd.Parameters.AddWithValue("@date_start", u.date_start);
                cmd.Parameters.AddWithValue("@date_end", u.date_end);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);


                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Update(pmmaDateBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"UPDATE tbl_pmma_date 
                            SET "
                             + dateStart + "=@date_start,"
                             + dateEnd + "=@date_end,"
                             + dateUpdatedDate + "=@updated_date,"
                             + dateUpdatedBy + "=@updated_by" +
                             " WHERE month=@month AND year=@year";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@month", u.month);
                cmd.Parameters.AddWithValue("@year", u.year);
                cmd.Parameters.AddWithValue("@date_start", u.date_start);
                cmd.Parameters.AddWithValue("@date_end", u.date_end);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToText(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }