public int update(DocumentKindModels item)
        {
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append("UPDATE ");
            sqlBuilder.Append("gov_doc_kind ");
            sqlBuilder.Append("SET ");
            sqlBuilder.Append("kcode = @1, ");
            sqlBuilder.Append("name = @2, ");
            sqlBuilder.Append("description = @3, ");
            sqlBuilder.Append("update_username = @4, ");
            sqlBuilder.Append("update_datetime = @5 ");
            sqlBuilder.Append("WHERE ");
            sqlBuilder.Append("kid = @6 ");
            this.Sql = sqlBuilder.ToString();
            MySqlCommand objCmd = new MySqlCommand(Sql, getConnection());
            objCmd.Parameters.AddWithValue("@1", item.KCode);
            objCmd.Parameters.AddWithValue("@2", item.Name);
            objCmd.Parameters.AddWithValue("@3", item.Description);
            objCmd.Parameters.AddWithValue("@4", item.UpdateUsername);
            objCmd.Parameters.AddWithValue("@5", item.UpdateDatetime);
            objCmd.Parameters.AddWithValue("@6", item.Kid);
            int rs = objCmd.ExecuteNonQuery();

            return rs;
        }
        public int insert(DocumentKindModels item) {
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append("INSERT ");
            sqlBuilder.Append("INTO ");
            sqlBuilder.Append("gov_doc_kind ");
            sqlBuilder.Append("( ");
            sqlBuilder.Append("kcode, ");
            sqlBuilder.Append("name, ");
            sqlBuilder.Append("description, ");
            sqlBuilder.Append("update_username, ");
            sqlBuilder.Append("update_datetime ");
            sqlBuilder.Append(") ");
            sqlBuilder.Append("values(");
            sqlBuilder.Append("@1, @2, @3, @4, @5");
            sqlBuilder.Append(")");
            this.Sql = sqlBuilder.ToString();
            MySqlCommand objCmd = new MySqlCommand(Sql, getConnection());
            objCmd.Parameters.AddWithValue("@1", item.KCode);
            objCmd.Parameters.AddWithValue("@2", item.Name);
            objCmd.Parameters.AddWithValue("@3", item.Description);
            objCmd.Parameters.AddWithValue("@4", item.UpdateUsername);
            objCmd.Parameters.AddWithValue("@5", item.UpdateDatetime);
            int rs = objCmd.ExecuteNonQuery();

            return rs;
        }
        public List<DocumentKindModels> select(int page, int limit) {
            int offset = (page - 1) * limit;
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append("SELECT ");
            sqlBuilder.Append("* ");
            sqlBuilder.Append("FROM ");
            sqlBuilder.Append("gov_doc_kind gdk ");
            sqlBuilder.Append(getBaseSQL());
            if (page > 0 && limit > 0)
            {
                sqlBuilder.Append(" LIMIT @limit ");
                sqlBuilder.Append(" OFFSET @offset ");
            }
            this.Sql = sqlBuilder.ToString();

            MySqlCommand objCmd = new MySqlCommand(Sql, getConnection());
            if (page > 0 && limit > 0)
            {
                objCmd.Parameters.AddWithValue("@limit", limit);
                objCmd.Parameters.AddWithValue("@offset", offset);
            }
            MySqlDataReader dataReader = objCmd.ExecuteReader();
            List<DocumentKindModels> lstDocumentKind = new List<DocumentKindModels>();
            DocumentKindModels item;
            while (dataReader.Read())
            {
                item = new DocumentKindModels();
                item.Kid = Convert.ToInt32(dataReader["kid"]);
                item.KCode = dataReader["kcode"].ToString();
                //item.ProcessPeriod = Convert.ToInt32(dataReader[""].ToString());
                item.Name = dataReader["name"].ToString();
                item.Description = dataReader["description"].ToString();
                item.UpdateUsername = dataReader["update_username"].ToString();
                item.UpdateDatetime = Convert.ToDateTime(dataReader["update_datetime"]);
                lstDocumentKind.Add(item);
            }
            getConnection().Close();
            return lstDocumentKind;
        }