public int insert(GroupPermissionModels item)
 {
     int rs = 0;
     StringBuilder sqlBuilder = new StringBuilder();
     sqlBuilder.Append("INSERT ");
     sqlBuilder.Append("INTO ");
     sqlBuilder.Append("gov_group_permission ");
     sqlBuilder.Append("( ");
     sqlBuilder.Append("group_id, ");
     sqlBuilder.Append("module_id, ");
     sqlBuilder.Append("permission_number, ");
     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.GroupId);
     objCmd.Parameters.AddWithValue("@2", item.ModuleId);
     objCmd.Parameters.AddWithValue("@3", item.PermissionNumber);
     objCmd.Parameters.AddWithValue("@4", item.UpdateUsername);
     objCmd.Parameters.AddWithValue("@5", item.UpdateDatetime);
     rs = objCmd.ExecuteNonQuery();
     return rs;
 }
        public List<GroupPermissionModels> selectPermission(int moduleId, String username)
        {
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append(" SELECT ");
            sqlBuilder.Append(" ggp.* ");
            sqlBuilder.Append(" FROM ");
            sqlBuilder.Append(" gov_group_permission ggp, ");
            sqlBuilder.Append(" gov_group_members ggm ");
            sqlBuilder.Append(" WHERE ");
            sqlBuilder.Append(" ggm.group_id = ggp.group_id ");
            sqlBuilder.Append(" AND ");
            sqlBuilder.Append(" ggm.username = "******" AND ");
            sqlBuilder.Append(" ggp.module_id = ");
            sqlBuilder.Append(moduleId);
            sqlBuilder.Append(" GROUP BY ");
            sqlBuilder.Append(" permission_number ");
            this.Sql = sqlBuilder.ToString();

            MySqlCommand objCmd = new MySqlCommand(Sql, getConnection());

            MySqlDataReader dataReader = objCmd.ExecuteReader();
            List<GroupPermissionModels> lstGroupPermission = new List<GroupPermissionModels>();
            GroupPermissionModels item;
            while (dataReader.Read())
            {
                item = new GroupPermissionModels();
                item.GroupId = Convert.ToInt32(dataReader["group_id"]);
                item.ModuleId = Convert.ToInt32(dataReader["module_id"]);
                item.PermissionNumber = Convert.ToInt32(dataReader["permission_number"]);
                lstGroupPermission.Add(item);
            }
            getConnection().Close();
            return lstGroupPermission;
        }
        public List<GroupPermissionModels> select()
        {
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append(" SELECT ");
            sqlBuilder.Append(" * ");
            sqlBuilder.Append(" FROM ");
            sqlBuilder.Append(" gov_group_permission ggp ");
            sqlBuilder.Append(getBaseSQL());
            this.Sql = sqlBuilder.ToString();

            MySqlCommand objCmd = new MySqlCommand(Sql, getConnection());

            MySqlDataReader dataReader = objCmd.ExecuteReader();
            List<GroupPermissionModels> lstGroupPermission = new List<GroupPermissionModels>();
            GroupPermissionModels item;
            while (dataReader.Read())
            {
                item = new GroupPermissionModels();
                item.GroupId = Convert.ToInt32(dataReader["group_id"]);
                item.ModuleId = Convert.ToInt32(dataReader["module_id"]);
                item.PermissionNumber = Convert.ToInt32(dataReader["permission_number"]);
                lstGroupPermission.Add(item);
            }
            getConnection().Close();
            return lstGroupPermission;
        }